The Magazine of the APPLE. KIM. PET
and Othar M^frf '^^ Systems
|i^j-^Pp?^i|a;|aM
■■ ^ ■tteSSt;j.;i;«::i. ;■:.;;
APPLE II
HIRES
Picture Compression
^commodore
.^0^'^"'
3iK
"o.^.^^.
2001 - 32N $1295'"'
^34900
2001 - 8N
2001 ■ 16B
2001 ■ 16N
2001 - 32B
16/32K Diagnostic Kit
Audio Amplifier PET
$795°°
$995°''
$995°°
$1295°°
$225""
$299'
PET to IEEE Cable
IEEE to IEEE Cable
C2N Cassette
8K Diagnostic Kit
DISKETTES:
DYSAN [Business Quality]
VERBATIM
N DENOTES GRAPHICS ON LARGE KEYBOARD
B DENOTES NO GRAPHICS ON LARGE KEYBOARD
$39"
$49"
$95°"
$30°°
5/$24''°
10/31»5
BUSINESS SOFTWARE
OSBORNE — CMS
General Ledger Disk $295°°
Accounts Payable Disk $195°°
Accounts Receivable Disk $195°°
Word Processor 16/32K Disk $99°°
Inventory Control Disk $195°°
[Available 12-1-79]
Mailing List Disk $95°°
Payroll Disk $295°°
[Available 1-15-80]
Word Processor Tape $24"
CBM — MIS
General Ledger Disk $120°°
Accounts Receivable Disk $120°°
Accounts Payable Disk $120°°
Payroll Disk $120°°
CBM — MIS Complete 7 Module Set $795°°
All 16N/16B Upgrade to 32K
Ship computer and check to:
Inventory Disk
Job Cost/Bid Disk
Customer Information
[Mailing List] Disk
$120°°
$120°°
$120°°
$310
00
HDmE CamPUTERS
1775 E, Tropicana
(Liberace Plaza)
Las Vegas, NV 89109
702/736 - 6363
FREE Software
LAS VEGAS series with any PET
computer purchase or upgrade
to 32K, valued at $200'"' or
more, including other software.
SUPERKIM
INDUSTRIAL CONTROL COMPUTER
Here is a powerful microprocessor control
system development tool and a complete
real-time multitasking microcomputer in
one package. There is no need to buy a
power supply, motherboard, memory
boards and separate i /O boards when your
requirements may be satisfied by a SUPER-
KIM. You may only need a couple of wire-
wrap sockets and a few LSI chips installed
in the big 3" x 10" onboard prototype area
to accomplish the required memory ex-
pansion and interface with the real world.
Some single chip Interface devices available
are: UARTS, 16 channel-8 bit analog to digi-
tal data acquisition systems, floppy disk
controllers and dot matrix printer con-
trollers. Furthermore, you will shortly be
able to buy single 5 volt supply pseudo
static 8K byte (that's right, you read it right,
8K X 8 bits) memory chips in a single 28 pin
package. These chips use the same tech-
nology developed for the 64K bit dynamic
RAMS now being manufactured by Ti,
MOTOROLA and others. Just five of these
chips and four 2732 EPROMs in the sockets
already supplied in the SUPERKIM will yield
a fully populated SUPERKIM with 44K bytes
of RAM, 16K bytes of EPROM With serial and
parallel I/O ports, and enough room left-
over in the prototype area for a LSI floppy
disk controller chip.Zilog already has, on the
market, a 4K byte version of this memory
chip that is pin compatible with the 8K byte
version; no need to rewire your sockets
when the larger memories become avail-
able. Put in 24K now and upgrade later
to 44K.
If you started with a KiM-1 , SYM-1 or AiM-65
and tried to expand it to the basic capabili-
ties of the SUPERKIM, you would need a
power supply (560), a motherboard ($120),
a prototype board (530), a memory board
($120), and an I/O board ($120) for a total
cost of from $620 in the case of the KIM-I
to $825 in the case of the AiM-65. You still
would not have real time multitasking
capabilities.
Multitasking is a situation where the micro-
computer appears to be doing more than
one job simultaneously. For example, the
SVOLT
REGULATOR
WITHWIREWHAP
CONNECTOR PINS
»COUMTEn TIMERS
l^HIFT REGISTERS -^
S-BIOtHECTIOHAL ^
DATA PORTS ^^
mi- SQUARE PIN
RIBBON —
CABLE CONNECTOR
HOLES
$395
00
microcomputer could be sending data to a
printer , accepting analog data from a
16-chaMnel data acquisition system and
presenting data to an operator monitor-
ing a LCD or LED display, all the while keep-
ing tra^rk of time.
Multitasking is accomplished on the SUPER-
KIM by use of vectored priority interrupts
and a r sal time clock. This real time clock is
implemented using one of the four on-
board (i522 programmable tone generators.
The SU PERKIM. with its keyboard, display
and ROM monitor, can be used as a system
analyz(ir for troubleshooting hardware
and software in-the-field or during system
development as an in circuit emulator. The
monitor can stop the CPU at any point
in the program, step through the program,
change the contents of the systems'
memory and CPU registers, and record the
CPU's registers during a selected portion of
the program. It offers one of the most
power =ul combinations of development
and dijignostic tools available on the
market today.
All of the above is unavailable on any other
singlet oard computer at any price.
mksroprcxJuct^s
2107 ARTESIA BOULEVARD • REDONDO BEACH, CA 90278 • (213) 374-1673
microsystems
P.O. Box 687
224 S.E. 16th Street
Ames, Iowa 50010
DPim
DAIM is a complete disk operating system for the ROCKWELL INTERNATIONAL
AIM 65. The DAIM system includes a controller board (with 3.3K operating system in
EPROM) which plugs into the ROCKWELL expansion motherboard, packaged power
supply capable of driving two 5 1/4 inch floppy drives and one or two disk drives
mounted in a unique, smoked plastic enclosure. DAIM is completely compatible in
both disk format and operating system functions with the SYSTEM 65. Commands
are provided to load/save source and object files, initialize a disk, list a file, list a disk
directory, rename files, delete and recover files and compress a disk to recover
unused space. Everything is complete — plug it in ;jnd you're ready to go! DAIM
provides the ideal way to turn your AIM 65 into a complete 6500 development
system. Also pictured are CSB 20 (EPROM/RAM) and CSB 10 (EPROM programmer)
which may be used in conjunction with the DAIM tD provide enhanced functional
capability. Base price of $850 includes controller board with all software in EPROM,
power supply and one disk drive. Now you know why /ve say —
There is nothing like a
DFiim
Phone 515-232-8187
[ iaaaaa
Table of Contents
Dual Tape Drive for SYM ■ 1 BASIC
by Gt'Ofge Vi/ells
Some Useful Memory Locations and Subroutines
for OSI BASIC in ROM
by S. R. Murphy
A Tape Indexing System for the PET
by Aijn R Hawthorne
Subroutine Parameter Passing
by Mark Svivanson
APPLE II Hires Picture Compression
by Bob Bishop
Assembly Language Applesoft Renumber
by Alan D. Flooter
Performing Math Functions in Machine Language
by Alfred J. Bruey
TSAR: A Time Sharing Administrative Routine
for the KIM-1
by Philip K Hooper
Interfacing the CI-812 to the KIM
by Jim Dennis
MICROBES: Ampersort
SYM-1 Baudot TTY Interface .
by Richdrd A. Leary
The MICRO Software Catalog: XIV
by Mike Rowe
Alarming APPLE
by Paul irwm
6502 Bibliography: Part XIV
by WilliaiTi R. Dial
11
14
^7
Si
61
November 1979
Issue Number 18
Staff
2T
Edftor/Publisher
Robert M. Tripp
33
4:
Assistant Editor
Mary Ann Curtis
43
Business Manager
Maggie E. Fisher
43
49
55
Circulation Manager
Carol Ann Stark
Production Assistant
L. Catherine Bland
Comptroller
Donna M. Tripp
Advertiser's Indet
Beta I ' "iHittM D»!vi>.i"«
ClasS' '<"''. fiiii:
COMf Ah
Com['u:' ' ■Will ■■!
The C.M! p'licris; Ino
Compiiti ■ Sticn
Conn*. 'I'.'i.l [I'lr- Oi .iiiniier'j
Elecf "■.■ ?|.r-(: ^ih'its. iiK-
EnclcT.i'"- &rrii[.
H Geil> ' Ci)>iirL!t--tjv5!eri.'-
Homi .''J'll^■u•.«r Ciiiifir
Huds "1 1'l'sjit 1 t::>.'<j!r.<nics
MICRl'
MICR'" MUSIC Inc
J1
n.20
n
■th t/.
34
41
iFC
4i
10 48
57
M ciL-prodi,i-tr.
O ■iirral Technolngy. iPc
fi Ae'sjofr. Inr
Pi~qijr?ma Iriiernaiionii'
Pr ■■firi'-j*.!*'! &o't*a:>'
R. iiitjCA C'<r;i(.ut.'n(7 Ini
R'lB-Eii'hrt.rise-o
SI VLFSESertronicV;. ik.
£.' ftp-iii' Goftwa'e
S- floi,',h, irn:
b-. fieigistii S'-'t'.A-jri
VV ' (JOR EkCtr'nliC'-.
W !St hido Elc.t'oniC!;
•l
IBC
b4
4 -4 l^i
4H
I'll I
^
is:a(](3ii^<£)i
y,
Skylcs Electric Works
PAL-80
TM
80 characters per line
8y2 inch wide thermal paper
Full graphics at 60 dots/inch
Interfaced to PET
Works with all PET peripherals
40 character per second rate
Microprocessor controlled
Bidirectional look-ahead printing
Quiet operation
No external power supplies
Only two driven parts
High reliability
Clear 5x7 characters
Attractive metal and plastic case
The Skyles PAL-80^'^ is a high speed thermal printer
offering the combination of text printing at 80 charac-
ters per line and continuous graphics at 60 dots per
inch. In the text mode, upper and lower case data are
printed at 40 characters per second. The 5x7 charac-
ters provide clear readable copy on white paper; no hard
to find, hard to read aluminized paper.
In the graphics mode, seven bits of each byte correspond
to the seven dots in each of the 480 print positions per
line. Since the computer driving the printer has full con-
trol over every print position, it can print graphs, bar
charts, line drawings, even special and foreign language
symbols. Despite its low cost, the Skyles PAL-80 is a
true intelli lent printer with full line buffering and bi-
directional look-ahead printing.
High reliab lity is designed in: The thick film thermal
print head las a life expectancy of 100,000,000 charac-
ters. Two [ iC stepping motors provide positive control
of the prin head and the paper drive.
The Skyles PAL-80 operates directly from a 1 15V 60 Hz
line (230V 50 Hz available). No external power supplies
are require I.
It comes c( mplete with an interface for the PET: a two
and a half oot cable plugs into the IEEE interface at
the back o your PET. Works with all PET models and
PET or Sk^ ies peripherals.
Skyles PAL-80 printer(s)
Please send me
complete with IVi foot interface cable to attach to my
PET at $675.00 each* (Plus $10.00 shipping and hand-
ling). I also will receive a test and graphics demonstra-
tion tape at no additional charge and over 150 feet of
872 inch wide black on white thermal paper $
would also like to order .
. rolls of 8V2 inch wide
by 85 ft. long thermal paper (black ink) at $5.00 each
.10 roll cartons at $45.00 $
VISA, Mastercharge orders call (800) 227-8398
California orders call (415) 494-1210
"California residents add 6 to 6/4% sales tax
where applicable.
PAL-80 SPECIFICATIONS
TEXT
Format
Print speec
Line Feed
Character \ et
graphic;
Format
Print Speei
COMMON
Paper
Dimension
Weight
80 characters per eight inch line
6 lines per inch nominal
40 characters per second
50 milliseconds nominal
96 Characters, including upper and
lower case, numerals, and symbols
480 print positions per line
240 print positions per second
814 inch wide thermal paper, available
in 85 foot foils, black image on white
12"Wx 10"Dx2y4"H
8 lbs (3.6 kg)
Skyles Electric Works
0301 Stonydale Drive
Cupertino, CA 95014 • (408) 735-7891
TM PAL-80 Printer on A Leash, a trademark of Skyles Electric Works Inc.
Dual Tape Drive for SYM-1 BASIC
If you want to make your SYM - 1 BASIC work with two
tape recorders and manage tape cassette files, here is
what it takes. A few important observations about the
BASIC are presented that could save you grief.
George Wells
1620 Victoria Place
La Verne, CA 91750
When I bought my SYM-1, I had no in-
tention of buying BASiC for it. However,
after not being able to show off my new
computer to my friends and relatives in a
way they could understand, I decided to
go ahead and get the BASIC ROMS.
Then I purchased a book of BASIC
games and copied several of them onto
tape. The need to have a convenient
means of copying tapes to make backup
copies became apparent. Also, I
discovered that the tape routines do not
work after BASIC has been interrupted
and reentered with a "GO" command
(warm start). After I recieved the tech
note from Synertek describing how to
put trig functions in BASIC, I found out
how to fix this problem. The tape
routines use system RAM to pass infor-
mation from BASIC and apparently the
call to "ACCESS" was omitted during
the warm start.
To make the second tape recorder
work, I added five components to one of
the buffered outputs to make it look like
the audio cassette remote control con-
figured for type IV (see figure 3-3, pages
3-7 of SYM reference manual). This is the
set up required for one of the recom-
mended recorders. Radio Shack CTR-40.
Refer to SYM reference manual figure
4-5A, pages 4-12. Note that pad 1 is
located between pads 2 and 6. The
follovkdng connections were made to buf-
fer PB4:
Install 470 OHM at location R5.
Install 2N2902A transistor emitter to pad
6 base to pad 9
collector to pad
1.
Install IK resistors between pads 6&9.
Install 1N914 diode anode to pad 1
cathode to pad 6
Install 1N914 diode anode to pad 19
cathode-pad 16.
Install subminiature phono pluc tip to
pad 6,
shield to pad 1.
My first tape recorder (General Elec-
tric model M8455A) is connected to the
normal remote control configjred for
type V. The audio out (LO) goes to the
MIC input. I discovered a trim pot on the
inside of the recorder which, if turned
completely counter-clockwise, makes
the recording ideal for the S> M com-
puter (terrible for voice though. Also, I
found it necessary to align the heads of
both tape recorders before I could get
reliable operation. The GE recorder is us-
ed normally to save files and the Radio
Shack recorder is used with special
routines to load files. The assembly
language program was written at a loca-
tion just before the trig function routines
and includes two sets of execute com-
mands for cold and warm starts to
BASIC that are compatible with the trig
functions and include a call to "AC-
CESS" so that the tape routines \n\\\
work after a vk^arm start.
The hex dump of the tape drive routine
plus the trig functions (from Jynertek
Systems Corp. Tech Note 53) cai be us-
ed to enter the code into your system.
Use the same verify command aid com-
pare checksums to check your vk^ork. I
save this file on tape using an II) of $31
which can be loaded and savcsd from
BASIC as file"1".
The sample run-stream illustrates how
to make it all work. First, a cold start to
BASIC was performed with the monitor
execute command (E E5A;. SYM
responds with everything down to line
100 which was entered to excer:ise the
trig functions and provide something to
save on tape. After running this single
line BASIC program, it was saved on
tape Vk(ith the file name "T". "NEW"
erases the program to indicate :hat the
tape will do a real load. The "US^" com-
mand to hex address 8035 takes us out
of BASIC and back to the monitor. To get
back to BASIC use the execute com-
mand (E E95). The response includes
everything down to the word "list".
Since nothing was listed, this shows
that the previous program has been
erased. It is loaded back in by transfer-
ring the cassette from the "save only"
recorder (in my case the GE) and putting
it on the "load only" recorder (Radio
Shack) and pushing the rewind button. If
this is the first time that the load only
recorder has been used since the SYM
was reset, then the recorder will start
rewinding immediately. Otherwise it will
wait until the "LOAD T" command is
entered. When the tape is rewound, the
play button is pressed and the recorder
stops automatically when the file is
loaded. Listing and running the program
show it to be the same as before.
The way I use routines to manage files
is through the use of three identical
cassette tapes each storing one copy
each of all my BASIC programs. I use a
fourth tape for temporary storage of a
program I am currently working on.
When I want to make a copy of all the
programs on tape, I put that tape into
the LOAD-ONLY or READ-ONLY
recorder, and push the PLAY button.
Then I put the tape that I want to copy to
in the SAVE-ONLY or WRITE-ONLY
recorder and push the PLAY-RECORD
buttons. I also keep a directory on paper
of the program files ID's on tape. Its a
simple matter to type a sequence of
BASIC commands consisting of a series
of LOAD A, SAVE A, LOAD B, SAVE B,
LOAD C, SAVE C, etc. If I want to insert a
new program from my temp tape, I just
swap tapes in the READ-ONLY recorder
to get the new program out, and then
swap back to continue with the old pro-
grams.
November, 1979
MICRO — The 6502 Journal
18:5
.E E5FI
.J
MEMCR-r SIZE? 3674
UIDTH-7 80
DK
PDKE202. 169!PDKE203. 14:PDKE196. I 04: PDKE197. 15
DK
100 PRINT SIMCl) .CD>:';5) >TflN<::3:' .f=lTN<.4J
RUN
.841470985 -.41^146836 -.142546543 1.32531766
DK
SAVE T
SAVED
DK
MEU
DK
"USR<:«:"3035"! O;:'
CB6D.3
.E E95
.13
DK
?IJSR(li."8B86"! O;'
□K
LIST
ok:
LQFID T
LDFIDED
DK
LIST
value. In fact, 5 are used for the value, br-
inging the total to 7. This is what gives
SYM BASIC its 9+ digit resolution. The
disadvantage Is that every simple
variable (including integer and string
variables which only need two and three
bytes respectively for their values) uses
more bytes than are usually needed. In-
cidentally, there is a memory saving
when using integer or string arrays.
However, Microsoft BASIC converts in-
teger values to floating points before us-
ing them, which takes longer than using
floating points in the first place.
Therefore, as a general rule, integer
variables should only be used in arrays,
and only when it is necessary to con-
serve memory space.
3.Don't make a mistake when typing a
line that prints a hex-formatted number.
If you don't follow the format exactly,
BASIC hangs up in a loop, printing
zeroes. If this occurs, you can recover by
doing a reset and going back to BASIC
with a warm start. Your program will still
be there, but as with any error, the pro-
gram cannot be continued.
100 PRIMT SINa> .CDSCS) .TRH'.3> !flTM<:4;)
DK
RUM
.341470985 -.416146S36 -.142546543 1.3£5S176t
DK
As a matter of habit I then read the
tape I have just written to verify that it is
O.K. and use it to copy into my third per-
manent tape. Then I repeat the process
going from the third tape back to the
original one. Finally, I read the original
tape to verify it. If at any point I detect a
bad load, I know that I will always have
an available on one of my tapes a copy
of the file in good condition, that hasn't
been overwritten yet.
Small changes can be made in any
program file by copying it onto the temp
tape with the changes (I usually make
two or three copies on the temp tape)
and then rewriting the file on each of the
permanent tapes by reading the file Im-
mediately before the one I want to
change to find where to start, and
reloading from the temp tape before ac-
tually saving the changed file.
Three Other Observations
I.Two words have been omitted from the
list of reserved words on page 9 of the
BASIC manual: "GO" and. "GET". "GO"
allows you to spell "GOTO" as "GO TO"
if you want; not really a good idea since
it takes three bytes of storage instead of
only one. "GET" must be a leftover since
it always generates an FC error.
2.Page C-2 of the manual states that 6
bytes of storage are used for each
variable: 2 for the name and 4 for the
RSSEHBLY LANGUAGE PRDGRAM
0E5R
0E5C
0E5D
0E61
0E62
0E64
0E66
0E6A
0E6E
0E72
0676
0E7A
0E7D
0E81
0E85
0E89
OESD
0E91
0E93
0E95
0E97
0E9e
0E9C
OERO
0ER4
0EA7
0EA9
OERB
DEAD
OEBO
0EB3
0EB6
0EB8
OEBB
OEBE
OECl
0EC3
0EC6
MODE
CDMFI6
ZERCK
P2SCR
DDR3B
DR3E
LDADT
34
4A 3
OD
33 36 37
OD
38 30
14 OD
50 4F 4B 45
32 30 32 aC
31 36 39 3H
50 4F 4B 45
32 30 33 2C
31 34 3fi
50 4F 4B 45
31 39 36 2C
31 30 34 3fl
50 4F 4B 45
31 39 37 SC
31 35
OD 00
47 30
OD
3F 55 53 52
28 26 22 33
42 38 36 22
2C 30 29
OD 00
84 FD
A9 09
20 A5 89
20 2E 83
20 9C 82
A9 10
8D 02 AC
8D 00 AC
20 7B 3C
A9
8D AC
60
Edu
E(.!1J
tFD
*89A5
E(!U $83£E
E(!U «8£9C
EUU tAC02
E(!U tACOO
E(!U *8C78
AIlR tE5A
a; CI I
B^■TE
ASCII
B-i'TE
A': CI I
BYTE
'JO'
tOD
■'3674'
■JOD
' 8 '
*14,tOD
BASIC COLD START CDMMAMD
CARRIAGE RETURN
MEMORY SIZE
CARRIAGE RETURN
LINE WIDTH
CONTROL T, CARRIAGE RETURN
CHANGE TAPE LOAD VECTOR
ASCII
'PDKE202, 169:PDKE£03, 14:
CHANGE TRIG VECTOR
:il POKE 196- 104: POKE 197, 15'
B'lTE
tOD.tOO CARRIAGE RETURN- END EXECUTE
ASCII GO' BASIC WARM START COMMAND
BiTE JOD CARRIAGE RETURN
JUMP TD MONITOR ACCESS SUBROUTINE
ASCII -?USP(J:"SBS6". Ci.)
B'lTE
SI V
LIA
JSR
JSR
JSR
LIA
ST A
ST A
JSR
LIA
S1A
R1S
MODE
!:9
CONFI
2ERCK
P2SCR
::;'.i)0
BDR3B
DR3B
LDADT
s;:ooo
0R3E
CARRIAGE RETURN, END EXECUTE
DO CUSTOM INITIALIZE FOP READ RECORDER
10000
BIT RB 4 OF VIA 3 £ET OUTPUT
TURN ON READ TAPE RECDRDEP
+3 LOAD TAPE BUT SKIP INITIALIZE
00000
TURN DFF READ TAPE RECORDER
18:6
MICRO ~ The 6502 Journal
November, 1979
HEX DUMP
.V E5H-FFF
0E5fl
4H
30
OD
33
36
37
34
OD .
68
UF3£
36
DD
60
81
49
OF
HH
h£
71
0E6£
38
30
14
OD
5
4F
4E
45,
£0
OFSH
7F
00
00
00
00
05
::;4
E6
5F
UE6H
3£
30
3£
£i:.
31
36
39
3H.
Eh
0F4£
IH
£D
IB
86
£8
07
FE
F8
69
nE72
■50
4F
4E
45
3£
30
33
£C,
Hh
0F4fl
87
99
68
89
01
87
l!3
35
5h
nE7fi
31
34
3H
50
4F
4B
45
31
h9
0F5£
DF
El
86
H5
5D
E7
;:S
83
34
0E82
39
36
£C
31
3
34
3h
5
63
OFSfl
49
OF
DH
h£
Hi
54
'■6'
8F
D£
iJESH
4F
4E
45
31
39
-' f'
2'"-
31
40
0F6£
13
8F
5£
43
39
CD
C
7£
91
riE9£
3'^
OD
00
47
30
OD
3F
55
9H
0F6H
FO
4fl
90
41
CO
76
FO
9£
54
i;iE9fl
53
5£
£8
£6
££
3S
4£
38
61
0F7a
£0
8
D9
h9
00
85
! 6
H5
E6
0EH2
3t.
££
£C
30
£9
OD
00
84
CF
nF7fl
C5
43
fl9
35
48
H5
f5
43
EE
OEflfl
FD
H9
09
£0
H5
89
£0
£E
IH
0F8£
fl9
B5
43
60
h£
9E
FtO
00
Dl
0EB2
83
£0
9C
8£
fly
10
8D
0£
'd.'---
0F8H
£0
3h
D9
h9
h7
HO
no
£0
64
riEBH
HC
811
00
flC
£0
7B
8C
fl9
D8
OF 92
58
D9
H9
00
85
B6
Fl5
C5
E3
riECS
00
3D
00
HC
6
OB
76
B3
H5
0F9H
48
H9
fl7
48
h5
16
'•8
H5
6E
OECm
33
BD
D3
79
IE
F4
H6
F5
DE
OFfl£
C5
48
H9
E7
48
6
fl9
9E
F7
NEDS
7B
83
FC
BO
10
7C
OC
IF
3F
OFHH
HO
00
4C
C5
D8
fl9
:::5
H4
OS
OEDh
6?
Cfl
7C
DE
53
CB
CI
7D
£6
OFB£
C5
£0
ID
D6
£0
C£
D9
h9
3E
rjEE£
14
64
70
4i::
7D
B7
EH
51
C9
OFBfl
59
R4
C5
fl6
EE
£0
];D
D8
19
iJEEfl
7H
7D
63
3
83
7E
7E
9£
69
OFC£
£0
C£
D9
£0
8£
DH
Fr9
00
F9
OEF£
44
99
3ft
7E
4C
CC
91
C7
6E
OFCfl
35
EF
£0
09
D6
h9
::fl
h4
C3
UEFH
7F
HM
HH
HH
13
81
00
00
7F
OFD£
C5
£0
06
D6
h5
E6
'■8
10
37
UFIJE
00
00
m5
B6
48
10
03
£0
55
OFDH
OD
£0
FF
D5
h5
B6
::!0
09
CC
OFiJH
36
DD
H5
El
48
C9
31
90
EO
OFE£
H5
16
49
FF
85
16
i:o
36
C
CiFld
07
h9
7£
HO
D7
£0
C5
D3
36
OFEfl
DD
H9
3h
H4
C5
£0
iD
D6
FC
OF 1 H
H9
C7
H4
C5
88
£0
C£
DD
56
OFF£
68
10
03
£0
36
DD
fl9
3F
9£
OFaa
63
C9
81
90
07
h9
35
H4
£1
OFFfl
H4
C5
4C
C£
DD
01
e:7
ijFSH
C5
£0
06
Db
68
10
03
4C
m9
BOE'
■•
^
MICRO™ is published morrtWy by:
MICRO INK, Inc.
34 Chelmsford Street
Chelmsford, Massachusetts
617/256-5515
Second Class postage paid at:
Chelmsford, MA 01824
Postmaster: Send address
changes to:
MICRO
P.O. Box 6502
Chelmsford, MA 01824
Publication Number:
COTR 395770
Subscription in United States:
$15.00 per year/12 issues
Entire contents Copyright © 1979
t>y: MICRO INK, Inc.
V m"]"i'
H
eEPUBBBC]'
PRESENTS IT'S
UTILITY PAC II
CHECKBOOK UPDATE TO DOS
AN EXEC FILE WRITES OVER YOUR CHE
PROGRAM TO AUTOMATICALLY UPDATE
INDEX FILE UPDATE
AUTOMATES BISHOP'S INDEX FILE
FIND CONTROL CHARACTER
WILL DISPLAY CONTROL CHARACTERS
CATALOG OR PROGRAM LISTING
SLOW LIST
FULL STOP 5 START CONTROL WITH EX
WITH APPLESOFT OR INTEGER BASIC
LIST HEADERS
PUT HEADERS ON YOUR LISTINGS WITH
NUMBERS OR REM STATEMENTS. AP II
AUTO WRITE
AUTO WRITE INSTRUCTIONS
USE EXEC FILES TO APPEND, ADD SUB
OR EDIT PROGRAMS. CONVERT INTEGER
SOFT. DELETE ILLEGAL LINE NUMBERS
EXEC READER
READS TEXT FILES FOR ABOVE
DISC SPACE
COMPLETELY WRITTEN IN APPLESOFT.
IN 3 SECONDS. GIVES FREE SECTORS
WITH LISTINGS AND DOCUMENTATION, PRICE
DISC liANAGEMENT SYSTEM *
CKBOOK
IT TO DOS
IT. WORKS
ROUTINES ,
TO APPLE-
ETC. ETC.
WORKS
AND BYTES
$19.95
EIGHT PROGR
COMPLETE UN
PLUS A UTIL
PROGRAMS WR
SYSTEM PROV
TRANSFER CA
A TWENTY-SI
EDUCATIONAL
ING OF THE
SYSTEM REQU
PRICE $19.9
[PR
SEND CHECK
AMS ON DISK TO PROVIDE THE USER WITH A
DERSTANDING OF THE DISK DRIVE COMMANDS
ITY PACKAGE TO INDEX 5 CATAGORIZE ALL
ITTEN FOR THE APPLE II COMPUTER. THE
IDES FULL SEARCH, EDITING AND DATA
PABILITIES.
X PAGE BOOKLET PROVIDES DETAILED,
TEQUNIQUES GIVING A THROUGH UNDERSTAND-
DOS COMMANDS.
IREMENTS: DISK II 5 APPLESOFT TAPE OR ROM
5 ON DISK FOR EITHER OF ABOVE
OCESSED 5 SHIPPED WITHIN 4 DAYS)
OR MONEY ORDER TO:
SOFTOUCH
P.O. BOX 511
LEOMINSTER, MASS. 01453
DISK DRIVE WOES? PRINTER INTERACTION?
MEMORY LOSS? ERRATIC OPERATION?
DON'T BLAME THE SOFTWARE!
lSO-1 ^"^J ISO-2
Pov/er Line Spikes, Surges & Hash could be (he culprit!
Floopies, printers, memorv & processor often interact!
Our unique ISOLATORS eliminate equipment interaction
AND curb damaging Power Line Spikes, Surges and Hash.
•ISOLATOR (ISO-1 A) 3 filter isolated 3-prong sockets;
integral Surge/Spike Suppression; 1875 W Maximum load,
1 KW load any socket $54.95
'ISOLATOR (ISO-2) 2 filter isolated 3-prong socket banks;
(6 sockets total); integral Spike/Surge Suppression;
1875 W Max load, 1 KW either bank $54.95
•SUPER ISOLATOR (ISO-3), similar to ISO-1 A
except double filtering & Suppression .... $79.95
•ISOLATOR (ISO-4), similar to ISO-1 A except
jnit has 6 individually filtered sockets .... $93.95
•ISOLATOR (iSO-5), similar to ISO-2 except
Jnit has 3 socket banks, 9 sockets total . . . $76.95
•CIRCUIT BREAKER, any model (add-CB) Add $ 6.00
•CKT BRKR/SWITCH/PILOT any model
(-CBS) Add $11.00
PHONE ORDERS 1-617-655-1532 ^g
/iV Electronic Specialists, inc.
171 South Main Street. Natick. Mass. 01760
Deptmi
November, 1979
MICRO — The 6502 Joirnal
18:7
ON YOUR XMAS
INCLUDING
IN BLACK & \A/HITE
Ol P Mr I $995! First floppy disk based computer
for under $1000! Same great features as the CI P plus more
memory and instant program and data retrieval. Can be
expanded to 32K static RAM and a second mini-floppy.
It also supports nc-nti^r
modem, real timer i
and AC remote interfri
aswellasOS-6f r
V3.0 development
disk operating
■system.
C2-8P:$799!
can be expanded to
features of the C2
8 slot BUS(3-time.'
ability than the C2
to48K RAM, dual floi
printerandbu!
C2-4P Mrl $1533! It's a big personal
computing mini-floppy system at a special package
Drice. Contains the famous C2-4P microcomputer
;vith 20K static RAM, 5" mini-floppy unit for instant
program and data loading, RS-232 circuitry
(for optional modem and printer), land diskettes
featuring exciting games, personal,
%„ business and education
applications.
wl r. $w*l9! A dramatic breakthrough in price and per-
former ce. Features OSI's ultra-fast BASIC-in-ROM, full graphics
display capability, and large library of software on cassette and
di !k, including entertainment programs, personal finance,
small business, and home applications. It's a complete pro-
gram Tiable computer system ready to go. Just plug-in a video
moni tor or TV through an RF converter, and be up and running.
1 5K total memory including 8K BASIC and 4K RAM —
expandable to8K.
The personal class computer that
a full business system. Has all the
■4P plus an
i greater expansion
-4P). Can be expanded
ipies, hard disk,
iness software.
wifc"4Pl $09o ! The professional portable that has over 3-times the display
capability of 1 P's. Features 32 x 64 character display capability, graphics, full
computer type keyboard, audio cassette port, and 4 slot BUS (only two used in
base machine). It has 8K BASIC, 4K RAM, and can
be expanded to 32K RAM, dual mini-floppies and
a printer.
w*"Or Ui I $ifc099! A full business system avail-
able at a personal computer price! The system includes the
pc werful C2-8P microcomputer {32K RAM expandable to
48K), dual 8" floppy unit (stores 8-times as much information
as i mini-floppy), and 3 disks of personal, educational and
imall business applications software. Has all the capa-
bilities of a personal system including graphics plus
the ability to perform Accounting, Information Manage-
The C4P and C8P offer a brilliant array of 16 colors including ment, and Word Processing tasks for small business,
black available in both alphabetics and graphics. The C4P and C8P have execution speed that is twice as
fast as Apple II, or Commodore PET and
over THREE times as fast as TRS-80. more
display than other personal computers .
Apple I[. Commodor e PE T, TRS-BO, and Alan 800 are registered Jrade names oi Apple Computer Inc., Commodore Business Maci ines Ltd., Radio Shack. Atari, respectively
16 COLORS AND COLOR
BEAT THE RUSH-ORDER NOWl
Name
Address
City
State __
C Send me a
Paynentby;BAC(VISA)
Cred t Card Account #
> enclosed
.MasterCharge
-Zip_
Phone
CnmPUTERSHDP
Boston Union N H Cambridge p
590 Comm. Ave. hie, ibU 288 Norfolk SI. ^'^ '^
(across fromB.U.) 603-473-2323 (nearM.lT.) TOT/s LCHARGEDOR ENCLOSED
247-0700 661-2670 All or lers shipped insured UPS unless otherwise requested
Some Useful Memory Locations and
Subroutines for OSI BASIC in ROM.
S.R. Murphy
201 N. W. 48th
Seattle, WA 98107
If you want to know more about yuur OSI BASIC, infor-
mation is presented which deta Is the use of RAM
Scratch Pad Memory and shows where some of the
most important Support Subroutines reside.
MICRO has published very little on
OSI's BASIC in ROM system. One can
only guess that fewer OSI owners are in-
clined to explore their machines and
bend their functions to their own uses in
contrast, perhaps, to owners of other
6502 systems. This is a pity because, in
contrast to what I read about PET, for ex-
ample, the BASIC ROM's and the
EPROM's that support BASIC, keyboard
polling, and the MONITOR are all easily
accessed by PEEK or through the
MONITOR.
This note may stimulate other OSI
BASIC in ROM owners to try some soft-
ware ideas for custom uses. The follow-
ing listing of BASIC pointer and
subroutine locations make it possible to
modify programs written for other
MICROSOFT 6502 BASIC interpreters for
use with OSI.
MICRO, number 6, pages 49-50, gave a
"PARTIAL LIST OF PET SCRATCH PAD
MEMORY", by Gary A. Creighton. Since
MICROSOFT supplied the BASIC inter-
preter for both OSI and PET, : principle
of parsimony suggests that thiire should
be a strong similarity between the two
systems even though OSI usns a more
primitive cassette I/O systen without
the file commands.
Table 1 represents the essence of this
similarity in parrallel to the PET table.
The notation is essentially tho same as
Mr. Creighton's except for t ie use of
Hex rather than Decimal.
IND (XY) is an address with the low
byte in location $XY and the high byte in
location $XY-i-1.
M(XY) is the content of memory loca-
tion $XY.
The description also follows the
original with the appropriate modifica-
tions for OSI operations. The t ible is not
complete, but, to the best of my
knowledge it is accurate.
Finally, in MICRO, number 11, page
37, Don Rindsberg presented an im-
pressive BASIC renumbering program. I
have not yet converted the program to
OSI because a BASIC renumbering
capability is not one of my favorite
needs. However, for OSI owners who
would like to "roll your own" following
Mr. Rindsberg, Table 2 is presented as a
substitution for his Table 1 on page 38
that lists the BASIC subroutines needed
in his program. The subroutines in Table
2 can, of course, be used for other pur-
poses. $B95E is an excellent Hex to
Decimal converter that can be called
with a simple machine language pro-
gram. Similarly, $A77F can be the basis
for Decimal to Hex conversion. $A8C3 is
a general purpose message printing
routine that Is easily incorporated into
any program. Finally, $A24D makes it
relatively simple to modify BASIC pro-
grams under computer control.
November, 1979
MICRO — The 6502 Jojrnal
18:9
Table 1
A Partial List of OSI BASIC
in ROM Scratch Pad Memory
(Ref. MICRO, No. 6, Pgs. 49 - 50)
IND(01) Initially, address of cold start ($BD11).
Replaced by warm start ($A274).
IND(06) USR INVAR address.
IND(08) USR OUTVAR address.
IND(OB) USR program address.
M(OD) Number of NULL'S selected.
M(OE) Terminal character count.
M(OF) BASIC terminal width.
M(11-12) Arguments of statements such as PEEK,
POKE, GOTO, GOSUB, line numbers, etc.
M(13-5A) Input buffer.
IND(71) Scratch pad address for garbage collec-
tion, line insertion, etc.
IND(79) Address of beginning of BASIC code.
($0301)
IND(7B) Address of beginning of Variable Table.
IND(7D) Address of first array entry in Variable
Table. If no arrays, end of Variable Table.
IND(7F) Address of end of Variable Table.
IND(81) Lowest string address.
IND(83) Scratch pad string address.
IND(85) Address, plus one, of highest allocated
memory.
M(87-88) Present BASIC line number.
M(89-8A) Line number at BREAK.
IND(8B) Pointer to BASIC code for CONT.
M(8D-8E) Line number for present DATA statement.
IND(8F) Address of next DATA statement.
IND(91) Address of next value after comma in pre-
sent DATA statement.
M(93-94) ASCII code for present variable.
M(BC-D3) Subroutine: Points through code one
byte at a time, RTS with code value In A
and carry clear if ASC(0 - 9); otherwise,
carry set. Return A = if end of line. Ig-
nores spaces.
IND(C3) Code location pointer for above
subroutine.
M(AF-BO) USR input variable storage.
M(FB) MONITOR keyboard control flag.
( = for keyboard).
M(100-107) Storage of conversion of floating point
number to ASCII.
M(1FF) Top of BASIC stack.
M(200-20E) Temporary storage for CR simulator
subroutine ($BF2D).
M(212) CTRL C flag.
( =$01 if CRTLCoff).
M(213-216) Temporary storage, keyboard polling pro-
gram (#FDOO).
$A24C
$A24D
$A77F
$B7E8
$B408
$B96E
$A274
$A8C3
$B95E
Table 2
OSI BASIC Routines Needed for
BASIC Renumbering
(Ref. MICRO, No. 11, Pg. 38)
^rint an error message from the message
:able. Enter with X containing the location of
he message relative to $A164. Message ter-
Tiinator is ASCII having bit 7 on.
3ASIC line insertion routine: Enter with line
issembied in the line buffer $0013-$005A with
)0 as line terminator. Also, character count
Tiust be In $005D and the line number(hex) at
50011/12.
Evaluate an expression whose beginning ad-
jress is in $00C3/C4. Use this subroutine to
;onvert from ASCII to binary, with the result
appearing in the floating accumulator:
500AC/AD/AE/AF.
Convert fixed number in $OOAD?AE to floating
lumber. Enter with the result appearing in-
he floating accumulator: $OOAC/AD/AE/AF.
Donvery binary value, such as line number, in
loafing accumulator to two-byte fixed
lumber and place in $0011/12.
Convert floating number at $OOAC/AD/AE/AF
o ASCII and place in string starting at $0101,
jreceded by a space or minus sign at $0100
ind terminated by 00.
3ASIC warm start. Prints "OK".
^rints message. Enter with ADH In Y, ADL in
A. Message is ASCII string ending with 00.
^rint the decimal Integer whose hex value is
n registers A and X, for example, a line
lumber.
I3EST of MICRO Volume 2
is available now.
All of the irrportant material from MICRO issues 7 through 12
(Oct/Nov 78 to May 79) presented in convenient book form. The
book is 8V: by 11 inches, 224 pages, and the material is
organized ty major computer type: AIM/SYM/KIM, APPLE,
PET, -and GliNERAL material. This is a companion volume to
BEST of MIORO Volume 1 which covered issues 1 to 6.
BEST of Ml DRO Volume 2 is available at your local computer
store for $£.00, or may be ordered directly from MICRO with
delivery anywhere in the world at:
$9.00 Surface Mail, or,
$13.00 Ai Mail.
BEST of M CRO Volume 1 is still available from you local
dealer for $3.00 or by mail from MICRO at:
$7.00 Surface Mail, or,
$10.00 Ai Mail.
Send order: to:
MICRO
P.O. 80X6502
Chelmsford, MA 01824
18:10
MICRO — The 6502 Journal
November, 1979
A Tape Indexing Systemi for the PET
A solution is provided for the PET cassette tap(» prob-
lem. Using inherent capabilities of the PET, a pro<;edure
is presented which permits use of the recorder's fnst for-
ward and fast rewind facilities to rapidly index and por-
tion of the tape.
Alan R. Hawthorne
611 Vista Drive
Clinton, TN 37716
A frustrating problem for PET owners
occurs when it becomes necessary to
load a program or read a data file that
has been written in the middle of a
cassette tape. Since Commodore chose
not to include a cassette recorder with
an index counter, the user is left with the
following options:
1) Load only one program per tape.
(This can make personal computing un-
necessarily expensive for the hobbist
with hundreds of programs.)
2) Let the PET slowly search through
the tape until it finds the correct file
name. (This process is much too slow,
since it can take up to 30 minutes to
search one side of a 60 minute tape.)
3) Guess where the program might be
on the tape and run the tape to this point
using the fast forward speed on the
recorder; then let the PET begin to
search for the program. (This guessing is
no fun. One often runs past the desired
program and wastes even more time).
I decided that there must be a better
way to use the PET for reading multiple
files. An index finder on the recorder
would, in essence, permit me to use op-
tion 3 above, but with the guesswork
reomved in positioning with the fast for-
ward speed. I contemplated implemen-
ting a photodetector and an LED as an
index counter, but this would require
modification of the recorder plus hard-
ware for counting and displaying. A
much simpler solution would be to
deveiope a software index counter that
would take advantage of existing
recorder switch-sensing and motor-
control carabilities of the PET. The
machine language program, described
below, uses an index number correspon-
ding to each program position on the
tape. Also given is the methoc for deter-
mining the correct index nu Tiber cor-
responding to each program on the tape.
Indexing Approach: Theory
A successful tape positioning pro-
gram can be implemented if the fast for-
ward speed of the recorder is run for the
correct length of time and if tf is correct
length of time can be determ ned for a
given program.
The first requirement can be met easi-
ly by using the PET's ability tD sense if
the recorder buttons are pressed and to
stop the recorder under progran control.
The tape of interest is simply loaded into
the recorder and rewound; tfie correct
time constant for the desired p rogram is
then entered into the PET. The: position-
ing program Instructs the user to press
"fast forward." The program vi/aits until
a recorder button depression is
detected, then begins timing until a time
corresponding to the index time has
elapsed, at which point the recorder
motor is stopped. A prompt character is
output to the PET screen indicating that
the tape is positioned at the beginning
of the desired program on tapo and that
the user should now pres the "stop" but-
ton. Upon sensing the depression of the
recorder stop button, the indexing pro-
gram places the recorder undi3r manual
control for subsequent use in loading
the program from tape and them exits to
the operating systems monitDr. If this
machine language positionlnci program
is stored in a safe memory SLCh as the
cassette number 2 buffer (M826-M1023)
when the PET is powered up, it will
always be available for positioning pro-
grams and data files with no time lost in
loading the program each time it is need-
ed.
The second requirement for im-
plementing an indexing system, that of
determining the correct time constant
for a given program, is more demanding.
Not being able to read the tape header
while the recorder is running fast for-
ward, one must find another means of
determining the fast forward time re-
quired for positioning a tape. A related
time that can be obtained easily is the
amount of time required to rewind the
program tape. The PET can detect when
the rewind button Is depressed and can
count time until the user presses "stop"
when the tape is rewound. This time can
be directly, although not simply, cor-
related with the fast forward time re-
quired to position to the beginning of the
program to be entered. Of course the
problem in relating the rewind speed to
the fast forward speed occurs because
the tape speed (cm/sec pass the
recorder head) varies even though the
drive speed (revolutions/sec) is the same
in each direction. (That the drive speed
is the same fast forward as rewind is
easily proven by measuring the time
taken to run through a complete tape in
the fast forward mode. This time can be
compared with the time taken to rewind
the tape. The two times should be ap-
proximately equal.)
With the forward and reverse drive
speeds the same, the following integral
equation can be used to relate the re-
wind time (tr) and the fast forward time
(tf) in terms of the minimum tape radius
(ro), the rate of radius change (c), and the
time (tm) required to rewind the tape
from the end to the beginning.
^f r*r
'(rQ + ct)dt = S \xq + c(t^ - t)]dt
This equation can be solved for the fast
forward speed:
I
i
November, 1979
MICRO — The 6502 Journal
18:11
Listing 1.
f
where
970
20
DO
D6
JSR
54992
973
A9
10
LDAIM
16
975
2C
10
E8
WAIT1
BIT
59408
978
DO
FB
BNE
WAIT1
980
AQ
02
02
NEXT
LDA
514
9o3
CD
02
02
WAIT2
CMP
514
986
FO
FB
BEQ
WAIT2
988
C6
08
DEC
08
990
DO
F4
BNE
NEXT
992
C6
09
DEC
09
994
10
FO
BPL
NEXT
996
A9
34
LDAIM
52
998
8D
07
02
STA
519
1001
A9
3D
LDAIM
61
1003
8D
13
E8
STA
59411
1006
A9
5F
LDAIM
95
1008
20
D2
FF
JSR
65490
1011
A9
10
LDAIM
16
1013
2C
10
E8
WAIT 3
BIT
59408
1016
FO
FB
BEQ
ViiAIT3
1018
A9
00
LDAIM
00
1020
8D
07
02
STA
519
1023
60
RTS
(2t t + k^ + 2kt -
m r r
vV'
'' -k
recorder is pressed, the cc
t t
m r
Vzt
Vzt
t.
t
f r
The value for k can be determined for
tapes of various lengths (15 min., 30
min., 60 min., etc.) by running fast for-
ward for a time, measuring the rewind
time, and evaluating equation 3. This
should be repeated for several different
times and an average value obtained for
k.
Program Implementation
Using the techniques outlined, a tape
indexing program can easily be im-
plemented for the PET. Listing 1 gives a
machine language program that will run
a tape fast forward for a given time and
stop the cassette motor. The program is
run, after the correct tape has been load-
ed and rewound, by calling the user
function X = USR (TC) where TC, the in-
dex time constant, is the number of jif-
fies required to position the tape cor-
rectly. Time is evaluated in jiffies
because the PET has a jiffy counter
which is convenient to use and the tim-
ing resolution provided is quite suffi-
cient.
The program uses several features of
the PET'S operating system. The
subroutine at M54992 converts the argu-
ment of the USR function from the
floating accumulator to a 16-bit integer
with the LSB in M8 and the MSB in IV19.
Bit 4 of M59408 senses the status of the
recorder switches. If any switch of the
bit is 0; otherwise it is 1.
The jiffy counter, which the PET uses
as a part of its real-time clock, is located
in M514 and is incremented 60 times a
second by the operating system. The
cassette flag is located in M519. A 52
must be loaded in order to control the
recorder motor using the program and
then restored to before exiting the pro-
gram, leaving the recorder under manual
control. With the cassette flag set cor-
rectly, the recorder can be stopaed by
the program by loading the value 61 into
M59411. Finally, the subrout ne at
M65490 is used to display a prompt on
the video screen informing the us9r that
the tape is positioned and that the
"stop" button should be pressed
The positioning program can b€ called
either from a BASIC program or by direct
command. Listing 2 is a BASIC program
for loading the machine languaije pro-
gram into memory when the PET is
powered up. The program is stored in the
upper portion of the number 2 cassette
buffer and will remain loaded until the
user writes over the memory or the PET
is reset. This location leaves available
protected memory from M826 to M970
for other machine language programs.
Listing 3 is a BASIC program called
TAPE capable of providing several
useful functions for a tape indexing,
system. The program, as currently
dimensioned, indexes 10 tapes with up
to 10 programs per tape. The functions
are available by entering various com-
mands. To position a tape for reading
program number k on tape numberi. ,
enter R. (The machine language program
of Listing 1 is assumed to be loaded.) To
update a program name or index time
constant in the index, enter a U. The tape
number and program number will be re-
quested by the program.
To determine the rewind time and fast
forward time for a program number k,
enter a T. The tape containing the pro-
gram to be indexed should be positioned
so that it Is at the end of the program. If
the tape is not at this point it can be
positioned by verifying, using the pro-
gram name (i.e., VERIFY "program
name"). This will position the tape cor-
rectly, even though a verify error will oc-
cur. The time constant measured and
displayed using the T command is ac-
tually the index time for the program
k -I- 1 and is automatically entered into
the index by the T command, so that the
U command is not needed.
To look at the Index of a given tape,
enter I and the tape number. The index
will appear on the PET screen with the
program number, name, and time cons-
tant displayed. To save the index data
file, an S command is entered. The index
file should be saved if any tape index
was updated or added to by using the T
command. The data file is placed direct-
ly following the BASIC program TAPE on
the tape. This is done by verifying TAPE
before writing the data file. If the index
data file has never been written on tape,
the TAPE program should be entered at
10200 (I.e., RUN 10200) instead of 10000
since the first thing the program does is
read the data file.
The most important part of the TAPE
program is the index time constant
00
REM
TAPE
10
DATA
32,
20
DATA
251,
30
DATA
198,
40
DATA
52,
50
DATA
169,
60
DATA
232,
70
FOR
A=970
80
POKE
1, 2
90
END
Listing 2.
POSITIONING PROGRAM,
208, 214, 169, 16, 44
173, 2, 2, 205, 2, 2
8, 208, 244, 198,
141, 7, 2, 169, 61
95, 32, 210, 255,
240, 251, 169, 0,
TO 1023: READ B :
X=USR(TC)
16, 232, 208
240, 251
9, 16, 240, 169
141, 19, 232
169, 16, 44, 16
141, 7, 2, 96
POKE A,B : NEXT
202, : POKE 2,3
determining routine. In order to use ttie
mactiine language positioning program,
all ttiat is needed is ttie time constant.
If one simply writes ttie time constant
by ttie program name on tiis tape label,
ttiere is no need for ttie TAPE program to
be used eacti time a specific program is
to be read. Instead, TAPE will most likely
be read wtien index editing or surveying
is desired. Ttie pertinent lines for obtain-
ing ttie index time constant are
14100-14700. Ttie values determined for
tm and k in equation 2 were 6000 jiffies
and 5000 jiffies respectively, for a 60
minute tape.
Alttiougti ttie constants for a 30
minute tape were somewtiat larger ttian
tialf ttie 60 minute tape constants, ttie
relatively low degree of accuracy re-
quired to position wittiin ttie 10 second
buffer written by ttie PET prior to eacti
program allows considerable freedom in
ttie selection of ttie constants. Line
14400 uses ttie PET BASIC function
WAIT to monitor the recorder buttons in
measuring ttie rewind time. Ttie user
stiould try to press "stop" as soon as
ttie tape is rewound, since consiiderable
error can be introduced if thu rewind
time is not measured consistently.
Final Comments
Pertiaps a word of caution is in order.
Ttie user stiould avoid placing programs
ttiat may require extensive revisions in
ttie middle portion of a tape, since ttie
revised program migtit ttien exte nd on to
ttie next program on ttie tape. However,
once a program tias been develciped, ttie
use of multiple files per tape is often
quite convenient.
After implementing ttie tape ndexing
and positioning programs, I find ttiat I no
longer dread ttie ttiougtit of tiaving to
read a program from ttie mjd(jle of a
cassette. In fact, reading ttie seventti or
eigtitti program on ttie tape takes only
sligtitly longer ttian reading ttie first pro-
gram. Hopefully, ottier PET entnusiasts
will find ttie program useful. In any case,
discovering and utilizing some of ttie
"hidden" powers of my PET was ha/f the
fun.
Listing 3.
10000 DIM TN$(10,10),TM(10,10)
10050 OPEN 1,1,0, "TAPE INDEX"
10070 FORJrITOlO
10100 F0RI=1T010:INPUT#1,TN$(J,I),T$:TM(J,I)=VAL(T$):NEXT:NEXT
10150 CLOSE 1
10200 PRINT"R : READ, U: UPDATE, T: TIME, I: INDEX, S: SAVE"
10250 PRINT"TAPE # & COMMAND" :INPUTL , C$
10300 IFC$="R"THENG0SUB12000:G0T010200
10400 IFC$="U"THENG0SUB1 3000 :G0T01 0200
1 0500 IFC$= "T"THENGOSUB 1 4000 : GOT0 1 0200
10600 IFC$="I"THENG0SUB1 5000 :G0T01 0200
10700 IFC$="S"THENG0SUB1 1000:GOT010200
10800 PRINT" f/7":GOTO10200
11000 PRINT"TAPE REWOUND". -INPUTY^
11100 VERIFY"TAPE":WAIT59408,16
11200 P0KE243,122:P0KE2J;4,2:0PEN1,T1,"TAPE INDEX"
11300 F0RJ=1T010
11400 FORI=1T010:T$=STR$(TM(J,I)):PRINT#i,TN$(J,I)","T$:NEXT
11500 NEXT
11600 CLOSE 1: RETURN
12000 PRINT"ENTER PGM # ":INPUTK
12100 PRINT"TAPE ";L;" LOADED & REWOUND" :INPUTY$
12200 PRINT"PRESS F-p' :X=USR(TM(L,K) )
12300 RETURN
13000 PRINT"ENTER PGM # TO UPDATE (0 TO EXIT) " : INPUTK
13100 IFK=OTHENRETURN
13200 PRINT"NEW TITLE" :INPUTTN$(L ,K)
13300 PRINT"NEW TIME":INPUTTM(L,K)
13400 GOT0 13000
14000 PRINT"PGM # & TITLE" :INPUTK,TN$(L,K)
14100 PRINT"ENTER 1 FOR 30 MIN TAPE, 2 FOR 60 MIN"
14200 INPUTZ:MX=3000»Z:TK=2500»Z
14300 PRINT"PRESS REWIND"
14400 WAIT59408 ,16,1 6 :T=TI :WAIT59408 , 1 6
14500 T=TI-T:PRINT"REWIND TIME = ";T
14600 TM(L,K-h1)=INT(SQR(2»MX»T-hTKT2-h2»TK»T-T^2)-TK)
14700 PRINT"FAST FORWARD TIME = ";TM(L,K-h1)
14800 RETURN
15000 PRINT"»","»»»TAPE ";L;" INDEX»»»" :PRINT
15100 FORI=1TO10:PRINT"#";I;TN$(L,I);TAB(32);TM(L,I):PRIKT:NEXT
15200 RETURN
Classified Ads
PET LANGUAGE MACHINE GUIDE-
comprehensive manual to aid the
machine language programmer. More
than 30 routines are fully detaiird so
that the reader can put them to use
immediately. Specify old or new
ROMS. $6.95 plus .75 for postage.
Visa or Mastercharge accepted.
Money back guarantee (10 days).
Contact:
ABACUS SOFTWARE
P.O. 60x7211
Grand Rapids, Ml 49510
NEW BOWLING PROGRAM FOR AP-
PLE: One to four players compete in a
standard bowling game. Challenging
game with excellent quality AP-
PLESOFT program. Cassette $9.95.
Order from:
C.E. Howerton
125 Marcella Road
Hampton, VA 23666
AIM 65 NEWSLETTER
Six bimonthly issues for $5.00 in U.S
and Can. ($12.00 elsewhere)
The Target, c/o Donald Clem
RR no. 2
Spencerville, Ohio 45887
Advertising Software for APPLE:
$25 buys SCROLLING WONDER,
GIANT LETTER, and HI-RES
ALPHANUMERtCS: on cassette,
16kb. $25 buys Mutti-Message with
fNTERLEAVED KALEIDOSCOPE, and
Multi-Message with ir4TERLEAVED
ABSTRACT ART: on cassette, 32kb.
Send check or money order to:
Connecticut Information
Systems
218 Huntington Rd.
Bridgeport, CT 06608
EXTENDED MONITOR for TIM reads
and writes KIM format cassette using
comparifor and 5 discretes; 7 more
commands. 2708 PROM at ECOO for
$28 incl. hardware; + $7 to relocate.
SASA or phone for info:
Phil Lange
206 Santa Clara Ave.
Dayton, Ohio 45405
(513) 278-0506
OPTIMIZE APPLESOFT pgms:
shorten variable names; remove
remarks and extra colons; con-
catenate lines; renumber; list
variable cross-references. (2) 1.3K
programs for (16-48K) Apple H's.
Cassette $15, disc $20 from:
Sensible Software
P.O. Box 2395
Dearborn, Ml. 48123
More Classifieds on page 20.
A Warning:
The MncRoTcn"
is For ProFessionol
Programmers — and Very
Serious Rmoteurs — Only
Now: a machine language pro-
gramming powerliouse for tlie
knowledgeable programmer who
wants to extend the PET's capa-
bilities to the maximum. The
MacroTeA, the Relocating Macro
Text EditonAssembler from Skyles
Electric Works.
The Skyles MacroTeA is a super
powerful text editor. 26 powerful
editing commands. String search and
replace capability. Manuscript feature
for letters and other text. Text loading
and storage on tape or discs. Supports
tape drives, discs, CRT, printers and
keyboard.
The Skyles MacroTeA is a relocating
machine language assembler with true
macro capabilities. A single name
identifies a whole body of lines. You
write in big chunks, examine, modify
and assemble the complete program.
And, when loading, the MacroTeA goes
where you want it to go. Macro and
conditional assembly support. Auto-
matic line numbering. Labels up to 10
characters long.
The Skyles MacroTeA is an enhance
Monitor. 11 powerful commands to
ease you past the rough spots of
program debugging.
The Skyles MacroTeA is a wanm
start button. Over 1700 bytes of
protected RAM memory for your object
code.
There's no tape loading and no
occupying of valuable RAM memory
space: The Skyles MacroTeA puts 10K
bytes of executable machine language
code in ROM (from 9800 to BFFF —
directly below the BASIC interpreter).
2K bytes of RAM (9000 to 97FF).
Like all Skyles Products for the PET, it's practically plug in
and go. No tools are needed. And, faster than loading an
equivalent size assembler/editor from tape, the MacroTeA is
installed permanently
The Skyles MacroTeA: 13 chips on a single PCB. Operates
Interfaced with the PET's parallel address and data bus or with
the Skyles Memory Connector (When ordering, indicate if the
MacroTeA will interface with a Skyles Memory Expansion
System. You can save $20.) Specifications and engineering are
up to the proven Skyles quality standards. Fully warranted for 90
days. And, as with all Skyles products, fully and intelligently
documented.
VISA Mastercharge orders call (800) 227-8398 (Except Calif.)
California orders please call (415) 494-1 2ia
Skyles Electric Works
10301 Stonydale Drive, Cupertino, CA 95014, (408) 735-7891
Subroutine Parameter
Passing
Mark Swanson
177 Hastings Mill Road
Streamwood, IL 60103
A technique that makes it easy to pass parameters to
subroutines is presented. Whiie this method has been
Icnown and used for many years on the big computers, it
may be new and useful to many microcomputerists.
Passing information from a main pro-
gram to a subroutine is usualiy done by
eitfier pusfiing it on the stack or storing
the information in an area common to
both routines. An alternative method in-
volved having the parameters after the
subroutine call.
When a jump subroutine is executed
the return address is stored on the stack
and control is passed to the subroutine.
If we put our parameters after the jump
subroutine instruction, the return ad-
dress on the stack will now point to this
data. The subroutine can now pull the
return address off the stack, fetch the
parameters useing the return address,
increment the return address to skip
over the parmeters, and use this new ad-
dress to return to the calling program.
Here is an example of using this
method of parameter passing to print a
character string. The program MAIN
contains a jump subroutine to the
subroutine PTRSTR. The address of the
beginning of the string follows the JSR
instruction. The end of the string is
marked by a zero byte. The routine first
references the stack to get the return ad-
dress and stores this in a temporary zero
page location (locations zero and one).
Using this address we now can access
the string starting address located after
the JSR. The string starting addrss is
moved into a temporary zero page loca-
tion (locations two and three). Using in-
direct indexed addressing we load a byte
of the character string, call a routine
which prints a single byte, increments
the Y register, and loops until the zero
byte is found. After the entire string is
printed, we increment the return address
by two to skip over the string address
parameters. We can now return to the
calling program via an Indirect jump to
the temporary return address locations
(locations zero and one).
This method of parameter passing
can be very useful when dealing with
subroutines that are called frequently or
which pass large amounts of data.
MAIN PROGRAM
3SR
5678
PRTSTR JUMP TO SUBROUTINE TO PRINT A STRING
$78 LOW PORTION OF STRING ADDRESS
$56 HIGH PORTION' OF STRING ADDRESS
RETURN HERE TO CONTINUE PROCESSING
"PRINT THIS MESSAGE"
$00 HEX ZERO TO MARK END OF STRING
ASSEMBLE L
ISI
0100
;MOVETBL 1 TO
TBL2
0110
. 8A
$400
0400— A/
08
0120
LOOP
LDY
#00
0402— B9
08
04
0130
LDA
TBLLY
0405- 89
08
05
0140
STA
TBL2,Y
0408— 08
0150
INY
0409 DO
F7
0160
0170
BNE
LOOP
0408
0180
TBL1
.DS
256
0508
0190
0200
T8L2
.DS
256
LABEL FILE 1 = EXTERNAL
START = 0400
TBL2:=05OB
110000,0608.0608
LOOP = 0402
TBL1 =0408
PRINT STRING SUBROUTINE
MARK SWANSON
SUBROUTINE TO PRINT A STRING OF CHARACTERS
023A
ZERO
*
$00E0
023A
ONE
*
$00E1
023A
TWO
*
$00E2
023A
THREE
♦
$00E3
023A
STACK
*
$0100
023A
PUTCHR
*
$1234
SOME PRINT CHARACTER SUBROUTINE
0200
ORG
$0200
0200
D8
PRTSTR
OLD
CLEAR DECIMAL MODE
0201
BA
TSX
TRANSFER STACK PTR TO X REG
0202 E8
0203
BD
00 01
0206
85
EO
0208
E8
0209
BD
00 01
020C
85
El
020E
9A
020F
E6
EO
0211
DO
02
0213
E6
El
0215
AO
00
0217
Bl
EO
0219
85
E2
021B
C8
021C
Bl
EO
021E
85
E3
SINCE POINTER ALWAYS POINTS TO NEXT POSITION
AVAILABLE, INCREMENT BY ONE
LOAD LOW PORTION OF RETURN ADDRESS
SAVE
INCR X TO NEXT STACK ENTRY
LOAD HIGH PORTION OF RETURN ADDRESS
SAVE
RESET STACK POINTER
ADDRESS OFF BY 1 , SO NOW WE
INCREMENT IT
HIGH ADDRESS TOO, IF NECESSARY
OVER
INX
LDAX
STACK
STA
ZERO
INX
LDAX
STACK
STA
ONE
TXS
INCZ
ZERO
BNE
OVER
INC
ONE
LDYIM
$00
LDAIY
ZERO
STA
TWO
INY
LDAIY
ZERO
ZERO Y REGISTER
LOAD FIRST PART OF STRING ADDRESS
SAVE
BUMP POINTER
LOAD SECOND PART OF STRING ADDRESS
STA THREE SAVE
SUBROUTINE NOW HAS THE STRING ADDRESS
NOW PRINT STRING UNTIL A HEX 00 IS FOUND
0220 AO
00
LDYIM
$00
ZERO Y REGISTER
0222 Bl
E2
LOOP
LDAIY
TWO
LOAD A CHARACTER OF STRING
0224 FO
06
BEG
FINISH
IF EOUAL TO ZERO, FINISHED
0226 20
34 12
JSR
PUTCHR
SOME SUBROUTINE TO PRINT A
0229 C8
INY
INCREMENT POINTER
022A DO
F6
BNE
LOOP
UNCONDITICNAL
022C 18
FINISH
CLC
CLEAR CARRY
022D A5
EO
LDA
ZERO
INCREMENT RETURN ADDRSSS BY
022F 69
02
ADCIM
$02
TWO TO SKIP OVER
0231 85
EO
STA
ZERO
STRING ADDRESS PARAMETERS
0233 90
02
BCC
END
DONE IF NO CARRY
0235 E6
El
INC
ONE
BUMP HIGH ADDRESS IF CARRY
0237 6C
EO CO
END
JMI
ZERO
JUMP INDIRECT TO RESUME MAI
CFARACTER
To Order PflOGRRMMCR'S ToolKit or MflCRoTcfl —
Custom designed to plug into your PET. So, when ordering, please indicate if your
Toolkit:
Is ProgromminQ Fu n?
Have More Fun,
Make Feujer €rrors.
Complete Programs Much
Foster . . . oiith the
BnSICpROGRnMM€R'S
Toolkit™
Now you can modify, polish, simplify,
add new features to your PET pro-
grams far more quicl<ly while reducing
the potential for error. That all adds up
to more fun . . . and the BASIC
Programmer's Tool Kit.
The magic of the ToolKit: 2KB of
ROM firmware on a single chip with a
collection of machine language pro-
grams available to you from the time
you turn on your PET to the time you
shut if off. No tapes to load or to
interfere with any running programs.
And the Programmer's ToolKit installs
in minutes, without tools.
Here are the 10 commands that can
be yours instantly and automatically
. . . guaranteed to make your BASIC
programming a pleasure:
AUTO
RENUMBER
DELETE
HELP
TRACE
STEP
OFF
APPEND
DUMP
FIND
Every one a powerful command to
insure more effective programming.
Like the HELP command that shows
the line on which the error occurs
. . . and the erroneous portion is
indicated in reverse video:
HELP
500 J = SQR(A*B/a)
... Or the TRACE command that
lets you see the sequence in which
your program is being executed in a
window in the upper corner of your
CRT:
.will be used with the Skyles Memory Expansion System, or
.will be used with the ExpandaPet, or Expandmem
.will be used with the PET 2001-8 alone
(We furnish connectors to the memory expansion bus and to ttie second cassette interface.
will be used with the PET 2001-16, -32 (chip only)
$80.00*
$80.00-
$80.00-
$50.00*
.will be used with Skyles MacroTeA
$50.00-
The Programmer's ToolKit is a
product of Harry Saal and his
associates at Palo Alto ICs.
So, if you really want to be into
BASIC programming — and you want
to have fun while you're doing it, order
your BASIC Programmer's Toolkit
YourMacroTeA. Custom designed for your PET. So specify your PET model when orderlng.$395.00- now. We guarantee you'll be de-
(Importani Savings: If it's to be used with a Skyles Memory Expansion System, the MacroTeA can lighted with it.
plug directly into the Skyles connector. So you save $20. The Skyles MacroTeA is only $375.00
when interfaced with the Skyles Memory Expansion System.) ~~
Send your check or money order to Skyles Electric Works. VISA, Mastercharge orders may call (800)
227-8398. (California residents: please phone (415) 494-1210.)
Ten Day Unconditional Money-Back Guarantee on all products sold by Skyles Electric Works, except chip only.
California residents: please add 6-6 Vi% California sales tax.
Skyles Electric Works 10301 Stonydale Drive, Cupertino, CA 95014, (408) 735-7891
[Pl^OtlK]!
i@[F¥MaiE][
Presents
Software and Hardware for your APPLE
SALES FORECAST provides the best forecast using the four
most popular forecasting techniques: linear regression, log
trend, power curve trend, and exponential smoothing. Neil D.
Lipson's program uses artificial intelligence to determine the
best fit and displays all results for manual intervention. $9.95
CURVE FIT accepts any number of data points, distributed in
any fassion, and fits a curve to the set of points using log
curve fit, exponential curve fit, least squares, or a power curve
fit. It will compute the best fit or employ a specific type of fit,
and display a graph of the result. By Dave Garson. $9.95
PERPETUAL CALENDAR may be used with or without a
printer. Apart from the usual calendar functions, it computes
the number of days between any two dates and displays suc-
cessive months in response to a single keystroke. Written by
Ed Hanley. $9.95
STARWARS is Bob Bishop's version of the original and best
game of intergallactic combat. You fire on the invader after
aligning his fighter in your crosshairs. This is a high resolution
game, in full color, that uses the paddles. $9.95
ROCKET PILOT is an exciting game that simulates blasting off
in a rocket ship. The rocket actually accelerates you up and
over a mountain; but if you are not careful, you will run out of
sky. Bob Bishop's program changes the contour of the land
every time you play the game. $9.95
SPACE MAZE puts you in control of a rocket ship that you
must steer out of a maze using paddles or a joystick. It is a real
challenge, designed by Bob Bishop using high resolution
graphics and full color. $9.95
MISSILE ANTI-MISSILE displays a target on the screen and a
three dimensional map of the United States. A hostile sub-
marine appears and launches a pre-emptive nuclear attack
controlled by paddle 1. As soon as the hostile missile is fired,
the U.S. launches its anti-missile controlled by paddle 0. Dave
Moteles' program offers high resolution and many levels of
play. $9.95
MORSE CODE helps you learn telegraphy by entering letters,
words or sentences, in English, which are plotted on the
screen using dots and dashes. Ed Hanley's program also
generates sounds to match the screen display, at several
transmission speed levels. $9.95
POLAR COORDINATE PLOT is a high resolution graphics
routine that displays five classic polar plots and aJso permits
the operator to enter his own equation. Dave Moteles' program
will plot the equation on a scaled grid and then flash a table of
data points required to construct a similar plot on paper. $9.95
UTILITY PACK 1 combines four versatile programs by Vince
Corsetti, for any memory configuration.
POSTAGE AND HANDLING
Please add $1 .00 for the first item
and $.50 tor each additional item.
• Programs accepted for publication
• Highest royalty paid
• Integer to Applesoft conversion: Encounter only those
syrtax errors unique to Applesoft after using this program
to convert any Integer BASIC source.
• Disk Append: Merge any two Integer BASIC sources into a
single program on disk.
• lnt(3ger BASIC copy: Replicate an Integer BASIC program
from one disk to another, as often as required, with a
single keystroke.
• Applesoft Update: Modify Applesoft on the disk to elimin-
ate the heading always produced when it is first run.
• Binary Copy: Automatically determines the length and
starting address of a program while copying its binary file
from one disk to another in response to a single key-
stroke. $9.95
BLOCKADE lets two players compete by building walls to
obstruct each other. An exciting game written in Integer
BASIC by Vince Corsetti. $9.95
TABLE GENERATOR forms shape tables with ease from direc-
tional vectors and adds additional information such as star-
ting address, length and position of each shape. Murray Sum-
mers' Applesoft program will save the shape table anywhere in
usable memory. $9.95
OTHELLO may be played by one or two players and is similar
to chess in strategy. Once a piece has been played, its color
may be reversed many times, and there are also sudden
reverses of luck. You can win with a single move. Vince Corset-
ti's program does all the work of keeping board details and
flipping pieces. $9.95
SINGLE DRIVE COPY is a special utility program, written by
Vince Corsetti in Integer BASIC, that will copy a diskette using
only one drive. It is supplied on tape and should be loaded onto
a diskette. It automatically adjusts for APPLE memory size
and should be used with DOS 3.2. $19.95
SAUCER INVASION lets you defend the empire by shooting
down a flying saucer. You control your position with the pad-
dle while firing your missile at the invader. Written by Bob
Bishop. $9.95
HARDWARE
LIGHT PEN with seven supporting routines. The light meter
takes intensity readings every fraction of a second from to
588. The light graph generates a display of light intensity on
the screen. The light pen connects points that have been
drawn on the screen, in low or high resolution, and displays
their coordinates. A special utility displays any number of
points en the screen, for use in menu selection or games, and
selects a point when the light pen touches it. The package in-
cludes a light pen calculator and light pen TIC TAG TOE. Neil
D. Lipson's programs use artificial intelligence and are not
confused by outside light. The hi-res light pen, only, requires
48K and ROM card. $34.95
TO ORDER
Send check or money order to:
P.O. Box 273
Plymouth Meeting, PA 19462
PA residents add 6% sales tax.
U.S. and foreign dealer and distributor inquiries invited
All programs require 16K memory unless specified
APPLE II Hires Picture Compression
Every APPLE owner is aware of the wonderful pictures
that can be made with the HIRES graphics. A very in-
teresting technique is presented which allows greater
efficiency in encoding picture information, and which
leads to some additional special effects.
Bob Bishop
213 Jason Way
Mountain View, CA 94043
Almost every APPLE II owner has, by
now, seen examples of how the APPLE II
can display digitized photographs in Its
HIRES graphics mode. These images
consist of 192 X 280 arrays of dots all of
the same intensity. By clustering these
dots Into groups (such as in "dithering"),
it is even possible to produce pictures
having the appearance of shades of
gray. Several "slide shows" of these
l<inds of pictures have been created by
both Bill Atkinson and myself and are
available through various sources, such
as the Apple Software Bank. A typical
"slide show" consists of about 11 pic-
tures on a standard 13-sector disk. Why
only 11 pictures? Because that's about
all that w/ill fit on a 13-sector disk.
Each HIRES picture must reside In
one of the two HIRES display areas
before it can be seen. The first area,
$2000-$3FFF, is called the primary
display buffer; the second area,
$4000-$5FFF, is called the secondary
display buffer. It is obvious that each of
these display areas are 8-K bytes long.
Consequently, HIRES pictures are usual-
ly stored as 8-K blocks of data, exactly
as they appear in a display buffer. But
do they have to be stored that way?
If you look closely at a HIRES picture,
you can almost always detect small
regions that look very similar to other
small regions elsewhere In the picture.
For example, HIRES displays usually
contain regions of pure white or pure
black. In the case of dithered pictures,
the illusion of gray may be caused by
micro-patterns of dots that are similar to
other gray patterns somewhere else.
Clearly, HIRES pictures tend to contain
a lot of redundancy. If there was some
way of removing this redundancy then it
would be possible to store HIRES pic-
tures In less than the customary 8-K
bytes of memory.
Suppose we were to divide the display
Into small rectangular clusters, each 7
bits wide, by 7 bits high. Then a picture
would consist of 24 rows of these pic-
ture elements ("pixels"), with 40 of them
per row. (Note the resemblance to the
APPLE ll's TEXT mode of 24 lines, 40 col-
umns per line!) The total number of pix-
els that would be needed to define a
HIRES picture would then be 40 times
24, or 960. However, not all 960 pixels
would be unique if there was redundan-
cy in this picture.
To try out these ideas, I used Atkin-
son's LADY BE GOOD picture (from the
Apple Magic Lantern — Slide Show 2)
shown in Figure 1, and wrote a program
to extract all the different pixels. I found
that only 662 of the 960 pixels were uni-
que. This meant that almost one third of
the picture was redundant!
Figure 1: (Max errors/pixel = 0)
November, 1979
IVIICRO — The 6502 Journal
18:17
M^-i ■■■ ••H-li'Esli-ISiSsli'iiifi; ■
Figure 2: (Max errors/pixel =3)
The next question that came to mind
was: of the 622 unique pixels, how 'uni-
que' were they? Was it possible that
there might be two or more pixels that
were almost the same, except for maybe
one or two dots that differed? If so, then
it could be possible to regard these as
being identical 'for all practical pur-
poses' since the error in the resulting
picture would hardly be noticed.
To examine this possibility, I modified
my program to extract only those pixels
that differed by more than a specified
MAX ERRORS/PIXEL Table 1 shows the
results. If we allow, at most, 1 dot to be
wrong in any one pixel, then we need on-
ly 492 pixels to define the picture, which
is only about half of the original 960 pix-
els! As we allow more and more errors
per pixel, the number of pixels required
to reconstruct the picture decreases ac-
cordingly, until we reach 28 errors/pixel.
fMiS^aii gglljgjgf!
At this point we are allowing half of the
dots to be wrong. Since total blacl< and
total white are always included in every
pixel set (to prevent black or white areas
from becoming dotted), pictures with
MAX ERRORS/PIXEL greater than or
equal to 28 can always be composed of
no more than two pixels, namely the
blacl< and white pixels.
Suppose we now try to reconstruct the
original picture from our extracted pixel
set. Clearly, the fewer pixels vie have
available for synthesizing, the poorer the
result will be. Figures 2 through 5 show
the results of synthesizing LADY BE
GOOD with MAX ERRORS/PIXEL, of 3, 7,
14, and 28. The number of pixels used in
each case was 245, 75, 15, and 2, respec-
tively. Notice that the difference in quali-
ty between Figures 1 and 2 is not all that
objectionable. The advantage that Figure
2 has is that it can be stored in l€!ss than
jp,5(r(.::::;;::!i:;;gr!^^gA!:Kr.::: .;
3-K bytes of memory! (245 pixels at 8
bytes/pixel, plus 960 bytes to define
which pixels go where.)
Thus it is clearly possible to store an
8-K l-IIRES picture in considerably less
than 8-K bytes, if you are willing to ac-
cept a little loss in the image quality. By
using this principle, I have produced a
"Super Slide Show" containing 33 pic-
tures on a single disl<. (Copies may be
obtained from Apple's Software Bank.)
Figure 3: (Max errors/pixel = 7)
SVfKl
TfiBLE
BILD
eeyi?
BLIP
mil
LUPf
eei?
H£yj
9&2C
OVER
0631
GOOC'
9S3F
RCON
esea
RUP
m%
LilOP
8eR4
COfff
me?
INC
8eC3
SENT-
mbs
NUTO
yen
RET
eerr
MOVE
iim
MLLIP
lie?
cm
1123
CLUP
112E
PREP
1154
INIT
1153
Sim
i28i-'i
X48
1220
XfiT
60Sm
VRT
m^i
ZflT
dm2
XTO
60S3
VTO
mm
2T0
8085
sew.
dmi
XMfiX
fm?
wtm
8689
XTMP
mm
VTff
906i-;
BEST
§889
AT
906C
TO
6885:
ERR
9f<iy
viN
9611
VIN
9812
PRffi'
6913
HGRL
8099
HGRh-
0D69
BITS
18h;';
BELL
FF3H
END
1261
The Compression Program
Listings 1 and 2 show the compres-
sion routines (and some associated data
tables), and require an APPLE II with at
least 32-K bytes of memory. The routines
consist of two basic parts— the
"analysis" portion, and the "synthesis"
portion.
The analysis routine ($0B00) searches
the primary HIRES display buffer
($2000-$3FFF) and compares each pixel
there with the pixels in its own current
pixel table (wfiich starts at $0600) look-
ing for a "match". If it finds a pixel in the
table that matches to within the
specified MAX ERRORS/PIXEL (location
$10), it calls a match and proceeds to the
next pixel in the picture. If it falls to find
a match, it adds the pixel to its current
pixel table and then proceeds.
The synthesis r-outine ($0B80) works in
the othpr direction. It first compares
each pixel of the primary buffer with
each pixel in the pixel table to find the
best match. It then places this pixel In
the corresponding location in the secon-
dary HIRES buffer, thus synthesizing the
best approximation to the primary pic-
ture as It can by using the pixels In Its
pixel table.(Since the analysis routine
doesn't know where its pixel table
originated. It is possible to synthesize
one picture from another picture's pix-
els! The result is usually surprisingly
good.)
The routines are very easy to use.
Simply load the picture to be compress-
ed into $2000-$3FFF, set MAX ER-
RORS/PIXEL into $10, and then call the
routine at $0B00. When the routine
returns, locations $07 and $08 contain
the number of extracted pixels In the
form: NUMBER = 1 -i- (contents of $07) +
40' (contents of $08).
To synthesize the picture from the ex-
tracted pixels, simply call the routine at
$0B80. When the routine returns, the
reconstructed picture will be in the
secondary HIRES buffer ($4000-$5FFF).
If you have a 48-K APPLE and a disk,
you can use the BASIC program shown
in Listing 3. This program calls the com-
pression routines (Listings 1 and 2) in a
more user-oriented way so that they are
even easier to use. The program displays
a menu of options that let you:
L— Load a picture from disk into
the primary HIRES buffer
1— Display the picture currently In
the primary HIRES buffer
2— Display the picture currently In
the secondary HIRES buffer
A— Analyze the primary picture
(create the pixel table.)
S— Synthesize the primary picture
using the current pixel table.
D— Issue disk commands.
November, 1979
Figure 4: (Max errors/pixel =14)
X— Transfer the compressed
picture to disk drive number 2.
None of the selections require you to
hit RETURN; just hit the corresponding
character. When specifying "L", the pro-
gram will ask you for the name of the file
to be loaded. When specifying "A", you
will be asked for the minimum error per
pixel that you will allow. (This does re-
quire a RETURN.). The "D" command
will give a colon (:) as the prompt
character and will allow you to Issue
disk commands. It will continue In this
mode until you give It a null command
(hit RETURN) at which time it will return
to the menu. The "X" command saves
the compressed picture (960 bytes) and
its corresponding pixel table (up to'2K
bytes) onto a disk file. (I will leave It up to
the Interested reader to figure out how
to "un-compress" this data.)
I'lMUIHUHlHIl
Concluding Remarks
While the methods In this paper work
pretty well, they may not represent the
optimum way of compressing APPLE II
picture data. For example, my choice of
7x8 dot pixels was somewhat arbitrary.
Is it possible to get better compression
ratios by choosing smaller (or larger) pix-
el sizes?
Another interesting question is; Given
a picture that was reconstructed from a
given set of N pixels, is it possible to find
another set of N pixels that gives a bet-
ter result?
I hope that these unanswered ques-
tions will help motivate someone else in-
to joining the investigation of HIRES pic-
ture compressing methods.
Figure 5: (Max errors/pixel = 28)
MICRO ~ The 6502 Journal
18:19
500
400
<0
■J
Ul
X
u.
o
oc
lU
S
300
200
100
max errors
number ot
per pixel
pixels
662
1
492
2
334
3
245
4
178
5
135
6
100
7
75
8
53
9
44
1
34
1 1
29
1 2
24
1 3
18
1 4
15
1 5
11
1 6
10
1 7
7
1 8
7
1 9
6
20
5
22
4
24
4
26
4
28
2
mmm
m^
^l.
Classified JM^-
SYM-t OWNERS-SYM/KrM Appsn-
dix to First Book of KIM detaUa
ctr^ngss to KIM games run on BAStC.
SVU-1. Changes Shown line by thn,
foad, modify, and run Appendix only
$4.25 First Book of KIM $», comt»'
.both $t2.5Q postpaid Order fromr
Robert A Peck
PO. Box 2231
Sunnyvatei CA 94087
DATA ENCRVPTIQN FOR SUPER-
BOARD 11 Powerfully secure
algorkhm. fast. and efficient.' Vitfeo
and/or UART I/O. Easy to use soft-
ware system available on high quaftt/
cassete tape. S21 95 includes detaih
ed instruction manual
D WOLF, Ph-O
15 Princess Rbad
London. NW1
England
MAX ERRORS/PIXEL
fi
Listing 1.
0834
2^11
8280
JSR fliM
8010
: BUILD PIKEL TfieLE
0BS7
fi583
0290
LDfi *KTO
0826
0839
8587
0380
STfi *KHfiX
8038
. OR mm
0B3e
fm4
9318
LDfi *VTn
0698
209311
0040
BILD JSR IHIT
0B3[>
85ee
0328
STfi *VnftK
&Bm
fi989
8050
LDfl 00
0B3F
f.m
0338
GOOD JNC *XfiT
0B85
8^'
0060
Sift *XRT
0B41
ft5B8
0348
LDfi =*:'ifiT
0B8?
8591
88?0
STft *VflT
0B43
csm
8358
CUP 28
0B89
fl991
0080
LDfi 01
0B45
Dm
0368
BNE BLfJP
0B@e
8^2
0090
STfl *ZfiT
0647
wm
0370
LDfi 00
0B8D
nm
0168
LDfi 03
0B49
8500
0380
STfi *XfiT
0B0F
8^
0110
STft *ZTO
0646
Esm
0398
INC ^VfiT
0B11
Bm
0120
BLUP LC'fi 00
0B4D
H585
0400
LDfi *VfiT
0B13
8503
01513
STfl *MTO
0B4F
C95.8
8410
CfP 18
0B15
8504
8140
STfi *VTO
0B51
imE
0428
BNE BLIF
0B1?
2ti2311.
8150
LLfPE JSR COI^'
0B5S
4C3fiFF
0438
JW BFI 1
0Blfi
fl510
8160
LDfi *ERR
0446
0B1C
C.506
0i70
CMP *SCOR
0450
••RECONSTRUCTHDN
0B1E
B01F
0180
BCS &m
0460
0B28
fl583
0190
LDfi *XTO
0470
. OR 0880
0B22
cse?
0200
C«P *XMflX
0B80
f\9m
0480
RCON LDfi 00
0B24
D0ro
0210
BNE ^€XT
0Bg;'
8D58C6
d4m
STfi $C050
0B26
fl504
0220
LDR *VTO
0B85
8D52Ce
0508
STfi $C852
0628
C508
0250
CMP *vmx
0B88
8D55C0
0510
STfi $!::055
eB2R
Fm
8246
BEQ OVER
0B8e
ec-SFce
0533
STfl fC057
0B2C
kuiee
0250
NEXT JSR NUTO
0B8E
8583
0530
STfl *XTO
0B2F
m.6
ma
BNE LUPE
0B90
8504
0S40
STfl *VTO
0631
2eFieB
0270
OVER jg? NUTO
0B92
R903
0550
LDft 93
18:20
MICRO -
- The 6602 Journal
November, 1979
rl
C)
J
0B94
8562
0568
STfl *ZfiT
1120 :
TO XTO. VTO. 2T0
08%:
fl9FF
8570
RLUP LDfl 0FF
1130 :
0698
858e
0580
STfi
*BEST
1140
. OR 1186
0B9B
R90e
9590
LDfi 08
1188
8fi
1150 f
lOVE TKfi
0690
sm
9600
STfi
*XfiT
1181
48
1166
PHfi
0B9f
8581
8610
STH *W^T
1182
98
1170
TVfi
0Bfl!3
H!^5.
8620
LDfi 81
1183
48
1180
PHfi
0Bfi2
f^m
0638
STfi
*2T0
1184
205411
1190
JSR PF£P
0BH4
29?S11
8640
LOOf
JSR
COf^P
118?
9488
1200 HI UP LDV *MftT
0Bfi?
fme
8656
LDfi
=*9:0R
1109
B18(^
1210
LDfi (fiT )..V
0BS9
L-oct'
%66
CMP
*eEST
ll!3B
fi483
1220
LDV *XTO
0BfiB
B^H
8670
BCS
rx^-ff
iim
91^
1230
STfi (TO ).V
0BHf)
85eP
0686
STfi
*BEST
118F
fi50D
1240
LDfi *fiT +01
0BBF
Hsee
dSSB
LDfi *>ifiJ
im
6984
1250
fiDC 04
0Bei
H5yi9
8780
STfi
*XT!«P
1113
Bm>
1260
STfi *fiT +81
0B13S
H585
871.0
LDfi
*VfiT
1115
FI5eF
1270
LDfi *T0 +61
0BB5
856H
8720
STfi
*VTItP
111?
(M4
1280
fiDC 04
eee?
fif^g •
8730
mm
LDfi
*KfiT
11 -i 9
856F
1290
STfi *T0 +81
0BR^
0740
Cl^^
^:}^s{py
iilB
Cfi
1380
DEX
0B8B
!)896
8750
BNE
IHC"
lilC
D0Ft
1310
SNE HW
0Bei)
R5B1
8760
LDfi
*VfiT
lllE
69"'"
1320
Flfi
0BBF
(;5e$^
6770
Cff*
*VMHX
lllF
m
1330
TftV
0BCi
roi.s
6780
BFO
SEND
1120
68
1340
PLfi
0BC3
Ehf?e
6790
m:
INC
*KhT
1121
Rfi
TfiX
0BC5
f)5e?
8800
LDR
*XfiT
1122
m
1360
RTS
eec?
0Bcy
C9?8
8810
8820
CHP
■[if-
LOOP
1370
1386
COMPiiRE PIXEL
eecs
r!9€i;^
6830
LDfi
80
1390
fiT XfiT. VfiL 7HT
0BCD
8S?£^
8840
STfi
*Kfil
1400
TO XTo^yrazTO
0BCr
V- .*.,-•„■ J.
8850
INC
*VfiT
1410
0SO1
D8f)i
8^?60
BNE
LOOP
1123
8fi
1420 i
-n(v|p Typ
BBUi
fi§9
8870
SEHD
LDfi
*XT!*?P
1124
48
1430
PHfi
0BD5
8588
8880
STfi
*kht
1125
98
1440
TVfi
0BD?
RSeR
ms^^
LDfi
*yyMp
1126
48
1450
PHfi
0Bf?9
mi
Qsm
STfi
:*VRT
112?
285411
1460
JSR PREP
0BDB
fti^i?
8910
LDfi 82
il2fi
R988
1470
LDfi 00
0BDD
8505
8920
STfi
*zto
112C
858£
1480
STfi *SCOR
BBW
2ee9i2
8930
JSR
STOP
112E
fl488
1490 !
:iUP LDV *XfiT
0BE2
seeeii
8946
JSR
f4WE
1138
B18C
150^3
LDfi (fiT ).V
0B£5
2eF10O
0950
JSR WJTO
1132
R403
1510
LDV *XTO
0eE8
R584
0960
LDfi *VTO
1134
518E
1528
EOR (TO >.V
0BEfl
C9i8
mm
CUP
18
1136
297F
1550
fl^C' 7F
0Bh'C
Def;8
mm
^E RLUP
1138
fl8
1546
TflV
0BEE
4C3fiFF
msd
m BELL
1139
696016
1556
LDfi BITS.V
1600
113C
6586
1560
mC *SCOR
0BFi
E683
1010
NUTC
JNC
*XTO
113E
8566
1578
STfi *SCOR
0BF2
PFM
1020
LL^ *MTO
1148
fiSSC-
1586
LDfi *fiT +81
0BF5
C928
1636
CMP
28
1142
6984
1596
fiDC 24
0Bf7
D^6
1640
BNE RET
1144
858D
1606
STfl *fiT +81
0BF9
H986
1050
LDfi m
1146
R58F
1616
LDfi *T0 +01
0BFE:
8503
1066
STfi *XTO
1148
6964
1626
fiDC 64
0afC'
E£«4
1070
I^C *VTO
114fl
8^
1636
STfi *T0 +81
0BFF
68
1889
1690
RET
RTS
114C
1140
Cfi
D-eDF
1640
1656
&Si CLUP
1180
• HOVE fl PIXEL
114F
68
1666
PLfi
1110
.FROHXflLVfiT.ZflT.
1158
ft8
1676
TfiV
November, 1979
MICRO -
- The 6502 Journal
18:21
115^
68
16fB
PLfl
1152
m
1690
m<
1153
6B
1700
173J
RT5
1154
am?
1728
PRhP LDR *ZflT
1156
6fi
17313
ROR
11.57
6fi
1740
ROR
1158
SB
17513
R«3R
1159
6fi
1766
ROR
115fi
2m
i7?0
flf-C* 60
115C
858[J
i7f30
SIP. *RT +81
115E
fi565
179J3
LDfl *ZTO
1160
gfi
18(B
ROR
1161
€f\
1810
ROR
1162
6R
18213
ROR
1165
f;fi
ism
ROR
1164
2966
ism
mo €Q
1166
:358F
iBf£
STfi *T0 +81
116:3
RJ^i
I860
L0fi *yfiT
116fi
&B
187^3
fiSL
116B
m
1880
mi
il6C
m
1890
flSL
iia>
m
19^3
TflIK
116E
Bmmc
1910
LDfi HGRL... K
1171
856C
1928
STfi m
1173
BDeeeD
19313
LDB H6RK. X
1176
29iF
1940
8ND IF
1178
emu
1950
fi0C *flT +81
li7B
sm>
I960
SIR *RT +01
117C:
R564
i9?0
LDR =*V'Tn
117E
8ft
1980
fiSL
117F-
8fi
1990
fiSL
1180
m
2em
fiSL
1181
m
2010
TftX
118£
BD80SC
2020
LDR HCRL. K
1185
858£:
2Qm
STfi *T0
1187
BD66&D
2040
LDfi HGRH. X
llSfl
29iF
2J35rf3
fif® IF
118C
656F
2060
ADC *T0 +01
118E
856F
2870
STfi *T0 +01
11^1
fl288
2080
LDX 08
1192
60
2090
2100
RTS
1193
2mmc
2110
mu JSR $0CC0
1196
fl97F
21.26
LDfi 7F
1198
8Dei68
2130
STR $€mi
119B
809164
2140
STfi $6481
119E
9)6168
2150
STfi $6881
llfil
soeiec
21^^
STfi $6C8i
llfl4
8D617y
2170
STfi STilU
llfl7
8D9174
2188
STfi 17481
llflfl
m^i?8
2190
STfi $7881
llflC-
8D817G
2200
STfi $7C0i
11B0
fi966
2210
LDfi 00
1182
8568
222&
STfi *yKftX
11B4
H9ei
2230
LDfi 01
18:22
11B6
8507
2240
STR*XMf5f
11B8
68
2250
2260
RTS
22?8
.OR 1288
1268
98
2280
STOR TVfi
1281
48
229J3
PHfi
1282
ft583
2.300
LDfi *XTO
120-4
8511
2310
STfi *ydH
1266
fi^4
2320
LDfi *VTO
128^:
8512
2.330
STfi *S'IH
128fi
282C12
2340
JSR
>m
120!:'
R513
23-50
LDfi *PROD+00
128F
858e
2360
STfi *T0 +00
1211
18
2370
CLC
i?1?
fi514
2.3a?
LDfi *PRO£?+01
1214
6980
2390
ADC 80
1216
BmF
24m
STfi *T0 +81
1218
R588
2410
LDfi *XftT
121B
8511
2420
STfi *XIN
12iC
R501
2430
LDfi «VfiT
121F
8512
244^1
STfi
*VIN
1220
282C12
24!:i
JSR
YA^
122-;
R5i3
2468
LDB
mm
1225
R068
24?f^
LDV
m
1227
9i9t:
248v?
STB
(TO ). V
1229
68
249!?
Pl.R
12^
m
25^6
TRV
122P
m
2518
RTS
JUfc-v.-..-
R512
252f?
X4m ! !>!-;
*VJM
8513
2530
SIR
fscHjci
2548
LDR
00
1232
8514
STR
1234
m3
2^m
RS!..
j^pRii-uv
1236
C. '.-J, V
''^-'f
ROl
1238
-•q':;'i'.5
RSI.
^P9)ji)
i23P
2fi4
21^9!^
ROL
:^pi>ni).i0j_
123C
9^\
2fM
R?L.
iftOpiV}
i23£
2614
26:-3
RiJL
rfippprvi w^
1240
R513
2£22
! Dft
:{<piyy-..
1242
mn
2638
fiSL
*pr6d
1244
2614
2640
ROL
*pP!-|f;,-.f(;if
1246
6613
2650
fiSL
*PROb
1248
2614
2666
ROL
:fppr.!rM.i<-[
12-ifi
6513
2670
fiDC
:{cp!;.nf;.
124C
8513
2680
STR
*PROb
12€
ft514
2690
LDR
*p5^n^,4.f^•1
1250
698&
2700
mc
00
1252
8514
2710
STR
:(cppr)f:.J.C<^
1254
R513
2720
LDR
^^m
12^
6511
2730
fiDC
mn
12.58
8513
2740
STfi
*pRro
125ft
Fi514
2750
LDfi
*pr6(m-0i
12^:
e^&^
2760
mc
00
125E
8514
2770
STfi
*PRO{>+01
1260
68
2780
279e
RTS
6502 Journal
November, 1979
1
o
22m
mT
nc
fi:/;>-''''-'
m3
VhT
D'-'
BK'v
2£2d
m
'1)5
Citif:;:'
2sm
KTO
rv:r.
. t.* _ '
88S?i
284^
\'Tri
■ 1.' — ■
@v5f-:T
2850
m
&^:
2860
SCOR
. DS
8«5S£
28?8
MHftX
0e?i7
2880
vfifix
.C<S
se&^c
2899
XTHP
. DS
98?&
2980
yTMp
0CfC^-:
2910
BEST
8689
2920
m
.DS
888V
2938
TO
.06
888H
2948
£f}C'
.DS
8818
2959
m
.CI 8311
2960
VIM
.Dl
8822
2979
ppor-(
iV
8817
2980
HGRL
.DS
85:88
2990
H6RH
. DS
PDf^^'
3899
BITS
. DS
1888
m.d
BELL
. DS^
FF2f>
3828
END
.EH
o
Listing 2.
0C^- 60 09 60 90 08 68 8i^ 0ff
0C88- 80 89 80 80 88 88 88 89
0C10- 00 88 00 90 08 88 80 90
0C18- 80 88 89 80 86 88 SQ 89
0C20- 60 08 08 90 1^ 88 89 00
0C28- 80 88 80 80 88 88 88 89
0C30- 00 08 09 00 80 88 80 00
0C38- 80 88 80 80 88 88 .88 Bd
0C48- 28 28 28 28 28 28 28 28
0C48- fi8 fl8 m m fig RS hS 08
0C50- 28 28 28 28 28 28 2S 28
0CS8- R8 fis fis m Rs Rs m m
QCm- 28 28 28 28 28 28 28 28
0C68- R8 m fi8 m m m m m
0C70- 28 28 28 28 28 28 28 28
0C78- R8 m fl8 m m m m m
0C88- 50 56 50 50 58 58 58 59
0C88- D0 D8 D0 D0 DS D8 D9 Du
0C90- 58 50 50 50 5€ 58 .58 .59
0C98- D0 06 D0 m m D8 D8 D0
dCm- 50 58 59 50 5f5 f^M 50 50
eCfS- D8 D8 D0 D0 D6 D8 D9 D0
0CB8- 58 58 50 50 58 58 58 59
0C^- 06 D6 D9 OB VB D8 iM 08
0D08- 28 24 28 2C 38 34 38 3C
0D08- 20 24 28 2C 38 34 38 3C
0D10- 21 25 29 2D 31 35 39 3D
0Di8- 21 25 29 2D 31 35 39 3D
3- 22 2b 2h 2h 32 36 3ft 3E
S- 22 26 2H 2E 32 36 3R 3E
0I>30- 23 2? 2e 2F 33 37 3B 3r
^•i^j'„- j--k li,*-- I.W r..*- %rfj, 'mf\f w-f w*.'
Mfiiss... 90 -''f. ■?& "'F "<■■'•' ~'*' ~'w "^F'
0iW;~ '>'■ '.-'f. "?0 ■:>r "r? ■??•■: 70 if
gna:*.. •;:=? 97 •?(:• -I^F "^? >7 "^b* ~'f
qapj?.. •-.? v7 s'g or- 7? ?7 i;i:; ?r
1908- 88 81 01 92 81 82 82 93
1808- 01 92 02 03 82 83 ^ 94
1010-- 61 82 02 03 82 83 83 04
1018- 82 83 03 04 83 64 84 85
1620" 91 82 92 03 82 83 83 84
1028- 82 83 03 04 83 8^ 84 05
1636- 62 03 03 84 83 84 84 85
10.38- 63 04 04 05 d^ 85 85 86
1040-- Bi 82 02 93 22 83 83 94
16^8- 02 83 93 94 63 84 84 95
1058- 82 83 03 94 83 84 84 95
18^- 63 94 04 95 Bi 65 85 96
1960- 62 83 83 d4 83 64 94 95
1068- 03 84 m 05 84 85 85 86
1079- 93 64 04 95 84 65 85 96
1Q7S- 04 65 03 06 95 86 86 97
Listing 3.
8 R^ MRITTEH EV: BOB BISI-fnp
10 C'ln m(A&)
26 fiNRL=ll*256: SVH=ftNflL+128: Pprs^r
4036+2*256+8*16
36 FLfiG=0:XFLfl0=€
100 CfiLL -3Z€: m£ -16300.. 8: PHfcr
-16383..
110 TfS 17: PRINq- "H E N U"
120 Tf^ 17: PRII-rr " ": pRlf-iT
130 PRIKT : PRINT " I - LOfiD PICTU
RE FROf? DISK"
140 PRINT : PRINT " fl - fffffLVZE PI
CTURE INTO PIXELS"
150 PRINT : PRINT " S - SVNTKESI3E
PICTURE FROM PIXELS"
166 PRINT : F-RINT " 1 - DISFlftV OR
IGINRL PICTURE"
176 PRINT : PRINT " 2 - DISR.HV SV
NTfESlZEC' PICTURE"
18!3
m
195
266
216
22f^
230
393
316
32t3
33J3
346
393
360
3?6
406
1006
1005
1016
1015
PRINT : PRINT " D ~ ISSUE DISK
PRINT : PRINT " X - SAVE COMPR
ESS£D PIfiTURE TO mSK"
VTRB 20: PRm "SELECTICN: "
REH REBD KeVPOftRD
Cm<^ PEX (-16394)
IF CHftR<128 THEM 216
POKE •-16384-Me. 6
ID=g '
IF CHHP-=-- fiSCC'L") THEM 10=^1
IFCHft!^-|fi?C<"fi") THEN 10^2
If r%\f^\fiSr:(«y>) THEM l\j~'^.
At vi ti ;i '. I : »-."—■ •- -e. .* • t ««i '■ A;.- :
rp- ruc'C'r-acfi"-:.'"', n-ipi Tr.-r'=^,
i. I '^t ii a :
2035
2046
2050
3000
IF ID:=^8 Then lea
GOTO 160g*Jf)
VTRB 20: TfiB 12: CliLL. -958:
PRINT "liOftD PlCTiiftE"
POKE -16300. 6: PCiirF -16383.
WTPR ■>■*•■ TMi-f:T "CJii." Wt:<?/if.'- "
fi$
IF H$-^"" THEN im
VTfte 22: PRINT "BLOflD ";ii$;
". fi$260a Dl"
GOTO 100
VTRB 28: !T«B 12: CftU. -958:
PRINT "HNfilYZ? PIf"^TtfpE"
POKE ~±6m.- 6: POKE -16363.
VTfffi 22: INPUT "nm ERRCfiS:/PIKEL
PaCE 16, IflXERfl- CfiLL BBL
afl6=l;m.RG=e:NU?©ER^40=^ Pt£K
<8)+ P£B^ <?)+l
PRINT "THERE FKE "
;MWSER;i PIXELS HITH Hfi:>^ ERROR
POKE -16384+16. 6
IF PEEK ^16384X128 THEN 2646
GOTO 100
VTfiB 28:
1056
208f3
^35
2010
2020
2025
2030 VTRB 22:
TfiB 12: PRINT "SVmHES!
2E PlCTfJlE"
3005 POf:! -16300. 0: POKE -16303.
0: VTfie 22: CflL -958
3010
3820
3030
3040
3850
3055.
3060
3070
3880
3085
4000
4050
6830
6065
6015
66
7006
7^30^=
?0i5
7020
7025
7030
7040
7045
7050
7060
7265
7070
7086
FOR K=l TO 5^; NDff K
IF FLAG THEN 3050
VTfiB 22: PRINT "THERE ARE MO PIX
ELSC€FINED VHf"
GOTO 3268
CALL SVN
:>aFiG=i
POKE -16384+16. 6
IF PEEK (-16384 )a2S imi 3670
IF PEEK (-16584)= FSCC'l") THEN
210
IF PEEK (-16384)= RSC("2") THEN
216
GOTO 108
POKE -16304.0: POKE -16382.
0: POKE -16300. 0: POKE -1629?
.0
GOTO 2dQ
POKE -16304. 0: POKE -16362.
0: POKE -16299.0: POKE -1629?
.0
GOTO 208
VTHS 28: TRB 12: ChLL -958:
PRINT "DISK cmmio"
POKE -16386.0: POKE -16363.
VTRB 22: INPUT ":«.fl$
IF m^--"" THEN 106
Vrm 22: TfiP 2: PRINT "»;F!$
PRINT : miNT : PRINT
GOTO 6618
POKE -16306.6: POKE -16363.
IF XFLRG THEN 7625
VTRB 22: PpY«T "tjo PICTURE HhS B
EQl SyNTHESI3£{5 VETf"
GOTO 7040
IF"NUH8ER<=:25e THEN 7066
VITiS 22: PRINT "T!£Rh f^E TOO m
W (";N«0;") PIXELS"
POIS: -16384+16.6
IF P£KK (-16384X128 THEN 7645
GURJ 1
\nm 22: INPUT "FILE NfiHK: "
.f»
IFR$=:"« THEN 166
CfiLL PRESS
VTRB 22: PRI^ff "BShVE «;fiS;
". fl$8008. L"; 968+2+8*NUH9ER;
"j D2-
7096 GOTO 100
Software for the Hpple II ilif^:
C d i
X
1
'
si
■
S
SC0RE=ie8
SCORE: 105
DYNAMAZE— a dazzling new real-time game. You
move in a rectangular game grid, drawing or erasing
walls to reflect balls into your goal (or to deflect
them from your opponent's goal). Every ball in
your goal is worth 100 points, but you lose a point
for each unit of elapsed time and another point for
each time unit you are moving. Control the speed
with a game paddle: play as fast as ice hockey or
as slowly and carefully as chess. Back up and re-
play any time you want to; it's a reversible game.
By Don Stone. Integer Basic (plus machine lan-
guage); 32 K;$9.95.
ULTRA BLOCKADE- the standard against which
other versions have to be compared. Enjoy Block-
ade's superb combination of fast action (don't be
the one who crashes) and strategy (the key is
accessible open space— maximize yours while min-
imizing your opponent's). Play against another
person or the computer. New high resolution
graphics lets you see how you filled in an area— or
use reversibility to review a game in slow motion
(or at top speed, if that's your style). This is a
game that you won't soon get bored with! By
Don Stone. Integer Basic (plus machine language);
32 K; $9.95.
What is a REVERSIBLE GAME? You can stop the play at any point, back up and then do an "instant
replay", analyzing your strategy. Or back up and resume the game at an earlier point, trying out a different
strategy. Reversibility makes learning a challenging new game more fun. And helps you become a skilled
player sooner.
WORLD OF ODYSSEY— a new adventure game utilizing the full power of Disk II, which enables the player
to explore 353 rooms on 6 different levels full of dragons, dwarfs, ores, goblins, gold and jewels. Applesoft II
48K; $19.95 includes diskette.
PERQUACKEY— an exciting vocabulary game which pits the player against the clock. The object of the
game is to form words from a group of 10 letters which the computer chooses at random. The words must
be 3 to 10 characters in length with no more than 5 words of any particular length. Each player has only
3 minutes per turn. The larger the words the higher the score. Applesoft II 16K; $9.95.
APPLESHIP— is a naval game in which two players enter their ships in respective oceans. Players take turns
trying to blast their opponent's ships out of the water. The first player to destroy their opponent's ships
may win the game. A great low-res graphics game. Applesoft II 32K; $14.95.
Available at your
local computer store
Ca// or write for our free
SOFTWARE CATALOG
Apple II is a registered
trademark of
Apple Computer, Inc.
DEALER INQUIRIES INVITED
FOUVERSOFT^ INC.
p. O. BOX 157
PITMAN, NEW JERSEY 08071
(609) 589-5500
Programs Available on Diskette
at $5.00 Additional
• Check or Money Order
• Include $1.00 for
shipping and handling
• C.O.D. ($1.00 add'tl. charge)
• IVIaster Charge and VISA
orders accepted
• New Jersey residents add
5% sales tax
^aaaQ &^^^
tm
FOR AIM/SYM/KIM
■ • '~
UPPER/lower case ASCII
128 Additional User Programmable
Characters: GRAPHICS-
SYMBOLS-FOREIGN CHARACTERS
Programmable Screen Format up to
80 CHARACTERS - 24 LINES
KEYBOARD and LIGHT PEN Interfaces
Up to 4K DISPLAY RAIVI
Provision for 2KEPR0M
Provision to add 6502 for
STAND-ALONE SYSTEM
ASSEMBLED AND TESTED
WITH 2K DISPLAY RAM
VIDEO PLUS: $24500
ITS EASY TO ADD VIDEO PLUSTM TO YOUR SYSTEM.
VIDEO PLUS is the most powerful expansion board ever offered for 6502 based systems. It has many im-
portant video featur^es ncluding:
Programmable D^play Format - up to 100 characters by 30 lines on a 'jood monitot.
A ROM Character Generator vvith UPPER and lower case ASCII characters.
A Programmable, Character Generator for up lo 128 user defined characters which may bo changed
under program control. You can define graphics, music symbols, chess pieces, foreign characters,
gray scale - and change them at will!
May be used with an inexpensive TV set or a quality monitor.
Up to 4K of Display RAM, with Hardware scrolling, programmable cursor, and more.
In addition to the video features. VIDEO PLUS also has:
A Keyboard Interface which will worl< with any ■■reasonable" keyboard.
A built-in Light Pen Interface.
Provision for a 2K EPROM or ROM for video control or othei software.
All of the memory - 6K RAM and 2K EPROM can be used as system memory whenever it is not in use as
display or programmable character generator.
VIDEO PLUS may be used directly as an expansion of an AIM/SYM/KIM system, or has provisio-^ for the
addition of a 6502 for use as a Stand- Alone system or Terminal.
Only requires +5V and has on board voltage regulators. Since it's the same size/shape as tho KIM or
SYM it may easily be placed under an AIM/SYM.KIM system. It uses the KIM-4 cxpanbion format.
Fully assembled, tested and burned in. Connect directly to your system or via the MOTHER PLUS board.
NOW AVAILABLE: AIM software for glass teletype mode. VIDEO PLUS at $245 includes your choice of
video subroutines or tne AIM version glass teletype mode. Either tape is available separately for $10.
Specify your choice when ordering. ^^^^^
iTHelJ _^_
(goo^pyiriK^QST
Prices listed above do not
include shipping and handling.
P.O. Box 3
So. Chelmsford. MA 01824
617-256-3649
Assembly Language
Applesoft Renumber
Alan D. Fleeter
4333 N. 71 Street
Milwaukee, Wl 53216
While there have been a number of programs published
for renumbering APPLE BASIC, most have been written
in BASIC and have therefore been slow. Here is a ver-
sion written entirely in assembly language - very fast
and very easy to use.
Chuck Carpenter gave a program in
the May, 1979 issue of MICRO for
renumbering Applesoft programs.
Although this is probably adequate for
most needs, there were still several
drawbacks. Among these are the follow-
ing:
1. User must make changes in BASIC
Instructions when the new line
number has more digits than the
original line number.
2 . it Is written in BASIC, so therefore,
slower than a 6502 assembly
language program.
3 . The program will take up the same
amount of memory, rather than
reducing Its size when It is possi-
ble.
4 . User cannot specify only a portion
of the program to be renumbered.
5 .The program did not work for all
types of IF-THEN statements.
Being a software person, I found it dif-
ficult to turn down the challenge to
answer these deficiencies. The results
of my efforts are contained in the follow-
ing assembly language program.
To load the program, type in the hex
numbers in the disassembled listing.
This is written for ar32K or larger APPLE
system, if you have a smaller system,
you can go through the effort of
relocating the program by hand. If you
do relocate, be aware that the symbol
table is stored at 7000 and continues as
needed, using two bytes per line
number. (A cassette version is available
for $5 for any size system by contacting
me. Make sure you state the amount of
memory that you have. I will also give
you a copy of this program at any other
special memory location if you have a
need for this.) Record from 6C00 to
6F9C.
To execute the renumberer, load your
Applesoft program, Hit reset and load
the binary executable renumber pro-
gram. Type: 6C00G. You will now see a
flashing cursor. Enter the line number In
the Applesoft program where the
renumbering will begin. Then enter the
next statement number you do not want
renumbered. Finally, enter the new line
number to start with, followed by the in-
crement between line numbers.
When the program is finished, (nor-
mally under 30 seconds,) type: OG, and
your program is renumbered. You can
now record it, or continue developing it
as normal.
An example of executing the program
is as follows:
52 (Start at line number 52...)
512 (And stopping before line
512...)
60 (Renumber, start with line 60)
10 (And go in increments of 10)
OG (And carry on!)
November, 1979
MICRO ~ The 6502 Journal
18:27
oCOO-
AV do LUA
#5B0
oCbC-
A9 00
LUA
tfiOO
oC FF-
C9
C4
CMP
#SC4
oC02-
au H3 oh STA
sohhb
oLbh-
oU hd oh
biA
SOhrd
oUOI-
FO
lU
BHQ
soD20
oCOb-
AV 00 LJA
*500
OCol-
oU h9 Oh
bl'A
»0rh9
oD03-
CO
IinY
OCUV-
Ob rC blA
5hL
0Co4-
AU Fh Oh
LUA
soFFi-
oD04-
CA
uhX
oCOV-
AV 2 LUA
#S02
oCo/-
oU h/ oh
blA
SoFF/
oDOb-
UO
hh
DNb
sot^^hD
oCOB-
05 Hb blA
Shu
oCoA-
Ab 0/
LUA
so/
oDO/-
90
lYA
oCOD-
20 Eti oD JSH
SoUtb
oCoC-
db hC
bi'A
SFC
oooa-
AO
01
LDY
#5U1
OCIO-
AU H4 oh LUA
^Ohh4
oCot-
Ab Ob
LUA
sob
oUOA-
Id
I.LC
0CI3-
BU t/ Of- iiA
$Oht: /
oC/0-
ob hU
biA
SFU
oOOB-
ob
FC
aUC
ShC
oC lo-
AU hb Of- LUA
Sohhb
oC72-
AO 00
Lur
#soo
oUOU-
ab
FC
biA
ShC
OCIV-
aO ta ot bi'A
>ohto
oC /4-
bl F(J
LUa
(SFC), !■
oJOF-
90
02
iiCC
SODI J
oCIC-
20 hB oU Jbt<
SoUcB
oC/o-
4d
FHA
OUl 1-
ho
FD
Ii^iC
ShD
OCIF-
AU H4 oh LUA
»ohh 4
oC / /-
Co
InY
oUI3-
Bl
FC
LUA
(ShC), Y
OC22-
BU £5 oh SfA
^ohtb
oC /d-
bl FC
LUA
(SFC), r'
oUlb-
UO
UO
buc
SoCh /
olJ2b-
AU hD Oh LuA
sohhb
oC /A-
40
FnA
oUI /-
Ab
BO
LUA
sou
oC^d-
oU to oh i>ih
>ohto
oC/B-
FO OO
btu
SoCUU
0Ui9-
db
OA
blA
SoA
OI.VB-
20 Hb oU JBh
soutd
oC/U-
Cd
InY
oDIB-
Ab
AF
LUA
sAF
oC^H-
AU h4 oh LUA
50hh4
oC /t-
A2 00
LUX
#500
oUIU-
Ob
o9
blA
SoV
oCJI-
oU hh oh blA
sohhb
oCBO-
Bl tC
lUa
{>tC), t
OUIF-
oO
KTb
oC34-
AU hb oh LUA
sohrb
oCd2-
OU £/ oF
CmP
SOhh/
OU20-
ca
iNY
oC-i/-
OU Fh oh biA
»Ohhh
oC ob-
Cd
IN I
oU2l-
CA
UHX
OC3A-
20 tB oU JSri
SOUhb
oe oo-
Bl hC
LUA
(ShO, i
oU 22-
FO
t3
BhO
SoUO /
oCJU-
AU h4 oh LUA
S0hh4
OCOB-
tU Ho oh
::,tiC
Sohcd
0D24-
20
FO
oU
JbW
soUhO
OC40-
OU he Oh biA
iiOhhL'
oCdB-
90 4/
BCC
S0CU4
oU2/-
AU
HH
Oh
LUA
Sohth
0C43-
AU hb Oh LUA
Sohhb
oCdU-
00
UtY
6U2A-
FO
C9
BhO
SoChb
0C4o-
dU hU or blA
sohhU
oCdH-
Bl hC
LUA
CShC), i
o02C-
90
iYA
OC49-
AV 30 LUA
#S3U
oC90-
CU Hb oh
CuiF
Sohcb
oU2U-
40
FFiA
0C4B-
dU hJ Oh bl'A
Sohtb
ocy3-
Cd
INY
o02E-
AU
Fh
6F
LUa
Sohht
oC4t-
AV 10 LUA
f^S 70
ISCV4-
Bl hC
LUA
cshC), r
6D31-
dU
Fo
oF
biA
s FF
oCbO-
Ob hh blA
Shh
oCVo-
HU Ho Oh
btJC
sohho
oU34-
AU
FF
oF
LUA
SoFFF
0Cb2-
Ay 00 LUA
#suO
oCVV-
BO 4 2
BCb
SoCUu
0D3/-
dU
F/
OF
bTA
soFF /
oCb4-
db hH bl'A
She
oC9B-
b8
UHY
oD3A-
A9
00
LUA
ff5(X)
oCbu-
AU ht oh LUA
»ohhh
oCVC-
Bl hC
LUA
(ShC), Y
oD3C-
au
irZ
Oh
blA
SOhh 2
oCbV-
oU ho oh biA
sohho
oCvt-
dl hH
OiA
(Shh.X)
603F-
00
i-3
oh
biA
SOhh J
oCAO-
Cd
iHY
oU42-
A9
/O
LUA
#S/0
oCAI-
ho FH
ilJC
Shh
oD44-
Ob
FF
bl'A
shh
0CA3-
Bl FC
LUA
(ShC), r'
oU4o-
A9
00
LUA
#S00
oCAb-
ol he
biA
(Shh,X)
O04b-
05
Fh
bfA
shh
oCA/-
Ho he
ilMC
shh
oU4A-
AO
00
LUY
#S00
oCAV-
UO 2
Di^e
SoCAU
oD4C-
Bl
fE
LUA
(Sht), 1
oCaB-
Ho hF
iNC
Shh
o04h-
CB
iiii
oCAD-
HH ho oh
iwc
SOhh o
oU4F-
CU
F4
oh
CMP
sohr4
EPROM PROGRAMMER |
oCBO-
UO Oj
bl-ib
SoCBb
0Ub2-
UO
0/
bi-ih
SoLbb
Model EP-2A-79
0CB2-
oCBb-
tH hv Oh
Od
ii-lC
UHY
50Fh9
0Ub4-
oObo-
Bl
CU
FH
Fb
oh
LUA
CMP
(Shh), Y
sohhD
i
OCBo-
AU Fo oh
LUA
soFho
0U!j9-
FO
47
BhU
S0UA2
'
oCdV-
91 FC
blA
(ShC), I
oUbB-
8B
UtY
^ '
OCBB-
Cd
iH'i
oUbC-'
Ho
FH
IWC
SFt
^ ,^c<' . ^
%t.- '
oCBC-
AU h/ Oh
LUA
SOhh /
0D5H-
ho
FH
iNC
shh
%f'
WJ^"^
TJjL
oCBh-
9 1 FC
blA
(sFC),Y
oUoO-
UO
02
bwh
So0o4
' 'xtf& ^™^fc
^t
OCCI-
Id
CLC
oUo2-
ho
FF
Ii-lC
Shh
^k
6CC2-
AU Fo oF
LUA
SoFro
oUo4-
Id
CLC
ii
oCCb-
oU FC oF
AUC
SOFFC
oUob-
AU
Fo
oh
LUA
Sohho
^m ^%
^ «b,j
oCOO-
OU Fo oh
bi'A
SoFFo
oUOO-
oU
FC
oh
ADC
sohhC
i^^s
oCCB-
AU F7 Oh
lUa
SOhh /
oUoB-
OU
Fo
oh
blA
sohho
k ^ iggiJII
^Hk
oCL't-
OU hU oh
AUC
SohhU
oUoH-
AU
F/
oF
LUA
SOhh 7
m.'" "^ -.i^^SBSBm
Smr
OCDI-
dD F7 oh
blA
SOhh/
00/ 1 -
oD
FU
oF
AUC
sohru
Wk J'y./^^mmmmHKl
I^J^
0CU4-
Od
FLA
oU74-
OU
F7
oF
bTA
Sohr/
Wm.-j^^^^m^f^^^Ki
■■H
oCUb-
db FU
bi'A
Shu
oU//-
hh
F2
oF
InC
SohF2
^Hliplll^^ JmP
^^w
oCU/-
00
FLa
oO/A-
UO
03
bi^h
soD/f
MUlliiiiiiniiiiiiTiTr^ «^ > fiES
RHt
oCUd-
Ob rC
blA
SFC
oU/C-
cH
F3
oF
ilNC
S0FF3
Mjjll^^|||g|pi«|fc. JBBH
f ^
oCUA-
Id
CLC
oO/F-
AD
F2
ot
LDA
sohh2
'^*^^'
oCUB-
90 9b
dCC
soC/2
oD82-
CU
Fd
oF
CMP
Sohro
oCUD-
od
fla
oUdb-
UO
Cb
blMh
S6U4C
SOFTWARE AVAILABLE FOR F-S, 3080, 6800, |
oCDE-
od
FLa
oUd/-
AU
F3
Oh
LDA
SOhh J
9085, Z-80, 6502, KIM-1, 1802, 2650.
EPROM (ype is selected by a personality
which piuKS into the front of the prog
module
ammer.
oOUF-
oce:-
Ab 0/
db FC
LUA
blA
SO/
SFC
oUdA-
oOdU-
CD
DO
F9
6i)
oh
CMP
but
Sohry
SOD4C
Powe
r requirements are 115 VAC. 50/60 HZ at 15
oCtb-
Ab od
LUA
soo
oUdF-
OO
PLA
watts
It Is supplied with a 36 inch ribbon cable
oCtb-
db FU
oTA
itU
OU90-
Ad
iAY
for connecting to microcomputer. Requires T'l |
oct/-
AO OO
LUY
#soo
oU9l-
Bl
hC
LuA
(ShC), !•
I/O
Jorts. Priced at $155 with one
set of
oCt9-
Bl FC
LUa
(SFC), Y
oD93-
C9
30
CmP
#s JO
softw
are Personality modules are showr
below.
oCHB-
3d
bHC
oDVb-
90
4A
BLC
SoUt 1
Part No. ProKrafns
Price
oClEC-
hb FC
bbC
SFC
0U9/-
C9
3a
CMP
ffSoA
PM-0
TMS 2708
$15.00
oChh-
AA
1 AX
0099-
BO
40
DCb
SOUt 1
PM-1
2704, 2708
15.00
oC£h-
CA
Ui=X
6U9B-
Cd
IinY
PM-2
2732
30.00
oChO-
CA
uHa
OUVC-
CA
dhx
P,M-3
TMS 2716
15.00
oChl-
CA
UHX
0U9U-
UO
h2
Biih
SoD9 1
PM-4
PM-5
TMS 2532
TMS 2516,2716,2758
30.00
15.00
0CF2-
CA
UHX
0U9F-
4C
0/
oU
JmP
SOUO /
oChi-
AO 04
LUY
#S04
0UA2-
20
JZ
oF
JbK
Soh32
Optimal Technology, Inc.
oCF5-
oCh7-
Bl FC
C9 BO
LUA
CMP
(SFC), Y
#SBO
oUAb-
oUAo-
Od
Ad
PLA
lAY
Blue
Wood127,Earlysville,VA 22936 |
OCFV-
FO 2b
BHQ
5OU20
oUa7-
A9
00
LuA
*SUO
Phone (804) 973-5482
oChB-
C9 AB
CiilP
#SAB
0UA9-
OU
hi
oh
biA
sorh 1
oChU-
FO 21
oeQ
soU20
oUAC-
aU
hO
oh
LuA
Sohru
oDAI--
3a
bbC
oEob-
cb
til
bbC
»Fli
OFOB-
db
tB
BTA
Stb
oDBO-
tU
EE
o^
bbo
SoFEb
0E05-
bO
rb
op
dlA
So FEB
oFOD-
aO
01
LDY
#S01
oDbJ-
bU
FO
Of-
dIA
iohro
oEoo-
bC
Eh
oh
orr
iiOhtF
oFOF-
cl
tA
LDA
CSrA), Y
oDbo-
10
Ob
cFl
SoDbD
oEob-
AD
Fa
oF
LOA
»oFFa
oF 1 1 -
FO
IC
dEO
i'Or2F
oDbd-
AV
Fi-
LDa
ffShh
oEoE-
JO
bEC
oF 1 3-
4d
PriA
oUdA-
oL)
Fl
or
DlA
SoFh 1
oEoh-
ED
EF
oF
Sac
SoFEF
oF 1 4-
OO
DEY
oUdU-
FO
Oo
bEQ
SODCb
oE/2-
oD
FA
oF
blA
»oFEA
oF Ib-
d1
tA
LDA
l^FA), <
oUbl--
20
03
oF
JbH
>oh03
oE /b-
vO
03
bCC
?oE7A
oFl /-
4o
PriA
oUl2-
^0
bl
oc
JSk
SOEbl
oE//-
ee
Eb
oF
ii^C
SoFFb
oF 1 0-
IB
CLC
oDCb-
bA
rxA
oE/A-
lb
CLC
oFI9-
oD
rO
oF
ADC
^■OFFO
oUCo-
60
EF
oF
bi'A
SoFhF
oE/b-
Ab
AF
LDA
SAF
oFlC-
vl
FA
d'lA
(^ta), r
oUCv-
a2
00
LDA
ff?0O
oE/D-
uD
to
oF
ADC
SoFrO
oF lE-
CO
li.Y
OUCb-
BlI
Ev
or
LDA
SoFtV, X
oEbO-
db
AF
SIA
SAP
oFlF-
Bl
FA
LuA
(;.FA), r
oUCb-
FO
Oo
bEQ
5OUU0
oEb2-
bb
f3
dlA
*Fo
oF21-
oD
M
OF
ADC
SoFr 1
OUUO-
y:
FC
blA
(>hc),r
oEb4-
AD
FO
or
LDA
»OFFO
oF24-
91
tA
BlA
(SPA), t
ODU/-
Lb
LiU
oEdV-
JO
CI
Bml
SoE4A
OF2o-
od
PLA
oDU-i-
cjE
EF
01-
DEC
^ohEr
oEbV-
AD
BO
LOA
SBO
oF2/-
Db
t-A
BlA
>FA
oDDo-
Ed
iL'if.
oEbB-
OV
00
ADC
ffSOO
OF29-
od
PLA
oUO/-
to
Ob
CFX
#SOb
oEoD-
do
bO
oTA
SBO
oF2A-
o5
FB
BTA
>Fb
6DL)V-
DO
FO
UNE
»ouCa
oEbF-
db
F9
blA
>r9
oF2C-
Id
CLC
oDDb-
AO
EF
ot-
LDA
»oPEF
0E9l-
AD
EO
oF
LOA
SOFFO
oF2D-
yo
EO
BCC
SoFOF
OUDt-
aa
lAA
ot94-
30
3b
bMl
»oECB
0F2F-
od
PLA
oDDF-
bi
FC
LDa
(SFO.r
oE9o-
AO
00
lDY
ffSOO
oFBO-
rtd
TAY
oDHI-
cv
20
CMP
#S2C
oEvb-
bl
Fa
LDA
CSt-A), Y
ot-31-
oO
kTB
6DH-1-
00
03
bNE
soDEb
oE9a-
Vl
fa
OiA
(SEo), Y
oF32-
BA
TXA
oUH3-
4C
20
oD
J MP
SoD20
oE9C-
3a
btc
oF3B-
4d
PriA
oDEb-
4C
F/
oC
JMP
»oCF7
oEVD-
AS
FA
LDA
>rA
oFB4-
AV
30
LDA
#S jO
oDEB-
20
oF
FD
JSk
SFDoF
oEyP-
t9
01
bbC
*SOI
oF3o-
A2
04
LOX
#S04
oDEH-
AO
00
LDY
#S0O
oEAI-
db
FA
blA
»FA
oFBd-
9D
Ev
oP
BTA
>orc9, X
oDl-0-
vb
TYA
oEa3-
bO
oz
BOB
S0EA7
oFBB-
CA
DEX
oUFI-
4d
PriA
oEAb-
Co
FB
DEC
»Fb
oFBC-
10
FA
dPL
sotBa
oOf/-
A9
00
LDA
#S00
oEAY-
30
bcC
oF3E-
AD
F7
oF
LDA
iOpt /
oDF4-
bU
EE
6F
blA
ioFEE
oEAb-
A3
hd
LOA
sFb
oF4l-
dD
Fb
oTA
SrD
6l)F/-
dU
rb
oF
STA
SoFFb
oEaa-
Ey
01
bbC
rfiOl
oF4J-
aD
Fo
oF
LDA
iOEPo
oOFA-
bD
F4
oF
blA
>oFh4
oEAC-
ob
Eb
bi'A
SFd
oF4o-
Ob
FA
OTA
SFA
oUFD-
BI
FC
LDA
(SFO.Y
oEAE-
bO
02
bCb
*oEB2
6F40-
AO
00
LDY
ffSOO
oDFF-
3a
iEC
oEbO-
Co
Fy
UEC
SF9
oF4A-
td
l.iX
oEOO-
£u
E3
oF
Sbc
SoFEb
oEb^-
3d
BEC
OI-4B-
by
V2
oF
LDA
S0tV2, i
oE03-
90
42
dCC
>oE47
oEBb-
AD
Fa
Oh
LDA
So PEA
op4E-
FO
IF
btO
Sotor
OEOb-
09
OA
CMP
rfiOA
oEBo-
Ey
01
BBC
#SOI
oFbO-
38
bcC
oE07-
tiO
3E
bCb
SoE4 /
oEbd-
OD
PA
oF
BiA
SoFFA
oFdI-
Ab
rA
LDA
*rA
oEoy-
Et
EE
oF
liMC
soFtE
otbb-
DO
03
dC3
»oE9B
oFb3-
P9
9/
oF
BBC
Sohy^, Y
oEOC-
4b
PlIA
oEdU-
CE
rti
oF
uEc
SoFpB
oFbo-
40
PnA
oEOU-
2H
F4
oF
hUL
>oFF4
oECO-
DO
Do
BiME
•5oE9d
oFb/-
Cb
IWY
oEIO-
2E
Fb
oF
HDL
SoFhb
otC2-
Id
CLC
oFbB-
Ab
t3
LDA
*FB
oEU-
AD
Fb
oF
LDA
»oFPb
oEC3-
od
PLA
oFbA-
r9
y2
oF
OdC
SOF92, Y
oElo-
4b
PriA
oEC4-
oD
FO
or
aDC
SoFFO
oFbD-
90
OB
BCC
?otoA
oEI7-
AD
F4
oF
LDA
?oFF4
oEC/-
AA
TAX
oF5F-
Ob
FB
BTA
SFb
oEIA-
4b
PHA
oECb-
Od
PLA
oFo) -
Ob
PLA
oElB-
zt
F4
oF
hUL
S0FF4
oEC9-
Ad
lAY
oFo2-
db
FA
BTA
SFA
OEIE-
2E
F5
oF
kdl
SoFFb
oECA-
00
kTB
oFo4-
db
DtY
oE^il-
2E
F4
oF
KUL
»oFF4
oECB-
Ad
FC
LDA
SFC
oFob-
Fc
E9
oF
IlJC
sotEV, X
oE^4-
2E
F5
oF
rtUL
SoFPb
oECD-
Ob
Fo
blA
Ira
oFoti-
DO
Eo
BNE
*otbO
oE^'/-
Ob
PLA
oECF-
AD
FD
LUA
SFD
oFoA-
ca
IwY
oE2b-
oD
F4
oh
ADC
S0FP4
oEDI-
db
Fy
olA
»Fy
oFob-
oo
PLA
oE<2B-
8D
F4
oF
ilA
iopr4
oED3-
AD
EO
oF
LDA
SoFFO
oFoC-
td
lux
oE2E-
Ob
PLA
oEDo-
49
FF
tOf^
#SFE
oFoD-
DO
DC
dNE
SOF4-B
oE2F-
oU
fD
oF
ADC
SoFrb
oEDB-
Id
CLC
oFoF-
A2
00
LDX
#S00
oE32-
bU
Fb
oF
bl'A
SoFFb
oED9-
o9
01
ADC
#501
oF71-
bD
6.9
oF
LDA
S01-E9,X
OEJb-
Ob
PLa
oEDB-
Id
CLC
oF 74-
C9
30
CMP
#Sbo
oE-io-
oD
F4
oF
ADC
SoFh4
oEDC-
Ob
l-C
aDC
SFC
oF /o-
DO
OA
BNE
SoPb2
Oc;39-
dD
F4
6F
blA
>oFr4
OEDE-
db
FA
blA
sFa
oF lo-
A9
00
LDA
#soo
oEjC-
A9
00
LDA
#S0O
oEEO-
Ab
FD
LDA
sFD
ot 7A-
VD
Ev
oF
BTA
SoFEV, X
6E3E-
oD
Fb
oF
ADC
ioFrb
oFF2-
o9
00
aDC
*S00
op/D-
td
InX
oE4l-
oU
Fb
oF
blA
SoFhb
oEE4-
bD
FB
BTA
SFB
oF /E-
to
04
CPX
#S04
oE44-
Cti
INY
oEEo-
Bl
FA
LDA
(SFA), Y
oFbO-
DO
EF
BnE
^oF/ 1
oE4b-
00
bo
bNE
SODPD
oEEB-
vl
Fd
STA
CSFb), Y
oFB2-
bA
TXA
ot47-
o8
PLA
oEEA-
Cb
InY
oFbB-
BD
FO
oF
STA
»oFrO
oE4d-
Ad
lAY
oEEB-
DO
04
BuE
SoEFl
oFBo-
A9
Ob
LDA
#SOb
oH4y-
oO
Hlb
oFFi)-
Eo
FB
hMC
SFB
oFoo-
3b
BEC
oE4A-
Ab
bO
LDA
sbo
oEtF-
Eo
F9
liMC
SF9
oFd9-
ED
FO
OP
bbC
SoFEO
oE4C-
E9
00
bbC
#?00
oEFI-
3d
bEC
oFdC-
ao
FO
oF
BlA
iOhr-O
oE4E-
4C
dD
oE
Jl«p
SotBD
oEF2-
AD
PA
oF
LDA
SoFFa
oFbF-
od
PLA
oEal-
yb
IVA
6EFb-
E9
01
BBC
#soi
oF90-
AA
lAX
oE52-
4d
PriA
otF7-
dD
rA
oF
STA
So pea
oF9l-
oO
kTB
oE53-
oA
IXA
oEFA-
BO
EA
BCB
SoEEo
oF92-
10
2/
bPL
?oFdD
oE54-
4d
PriA
oEFC-
CE
FB
oF
uEC
SoFFB
oF94-
Ed
Lij.
otbb-
A:3
AF
LDA
»AE
oEFF-
DO
Eb
bnE
SoEEo
oF9b-
03
i t i
oEb/-
ao
Fa
OlA
SFA
oFOl-
FO
6t-
BEQ
SoEC2
of-9o-
04
i>. i
otbV-
ia
bEC
oF03-
yo
TV A
OP9/-
00
DHa
oEbA-
tb
FC
bbC
»PC
oF04-
4b
PrIA
oF9b-
OA
aBi_
oEbC-
dO
rA
oh
blA
SoFFa
oFOb-
Ab
FC
LDA
SFC
oF99-
00
bHK
oEdF-
Ab
do
LdA
»B0
oF07-
db
FA
BTA
SFA
oF9A-
01
00
OHA
i. S OU , A )
oEol -
Ob
t-ti
blA
SFd
oF09-
Ab
FD
LDA
sFd
oF9C-
00
BHiv
Performing Math Functions
in iVIachine Language
If you are afraid to try doing mathematical functions in
assembly language, then this article may help you get
started.
Alfred J. Bruey
201 S. Grinnell Street
Jackson, Ml 49203
Since addition, subtraction and stiif-
ting are ttie only arithmetic functions
available in machine language for most
small computers, it becomes necessary
to find methods to perform other
mathematical operations using addi-
tion, subtraction, and shifts In combina-
tion with other commands available on
the programmer's microprocessor.
Multiplication Is an example of an
operation that is commonly performed
in this v\^ay. Let's look at a particular ex-
ample. Suppose f/e v\^ant to multiply 187
by 345. It Is obvious that f/e can clear a
register and add 187 a total of 345 times
to arrive at the ansv\^er, but we soon
discover that it is more efficient to per-
form the same function by combining
additions with shifts.
Using the shift command, we would
add 3 187s, then shift left, then add 4
187s, the shift left, then add 5 187s to ar-
rive at the final product. Thus, we have
replaced 345 additions with 12 additions
and 2 shifts. In the same way, repeated
subtractions may be combined with
shifts to implement a division algorithm.
Division and multiplication algorithms
are often described In the programming
manuals that come with a computer. A
programmer soon needs other mathe-
matical functions and must find a way to
perform them with a limited instruction
set and limited computer memory. If the
functions become too complicated, one
must add memory or go to a higher level
language, such as BASIC.
The purpose of this article is to
demonstrate the power of the lovi/ly addi-
tion and subtraction commands by
developing an algorithm for extracting
the square root of a number. The al-
gorithm Is described and a flow chart Is
presented along with a 6502 lisiting for
the KIM-1.
The square root algorithm to be
presented here is based on the equation:
n
^ (2k-1) = n^ ; n an integer greater than
K = 1
which says, in English, that the sum of
the first n odd Integers is equal to the
square of n. For example:
1-1-3-1-5-1-7-1-9 = 25 = 5^
That is, the sum of the first 5 odd in-
tegers is equal to 52, or 25. This equation
is easily proven true for all positive In-
tegers by mathematical induction.
The method implemented heie Is to
subtract first 1 , then 3, then 5, and so on,
from the number whose square root is
desired. The number of subtractions,
less 1,that it takes to reduce the original
number to a nonzero negative number is
the square root. For example. If X = 25:
25-1 =24; 24-3 = 21; 21-5 = 13
16-7 = 9; 9-9 = 0; 0-11 =11
Since it took 6 subtractions to reduce
25 to a number less than 0, the answer is
6-1=5. Notice that this method
gives only the Integer part of the answer,
so if X had been any value from 25 to 35,
you would have arrived at the same
answer. Remember— when you take the
square root of a number, your answer
has only about half as many significant
digits as the number.
The original value (NUM) is placed In
the accumulator. The answer will be in
the Y register and also displayed on the
KIM'S seven segment LEDs (POINTH).
Notice that the algorithm as described
below will not handle very large
numbers. To use this for practical pro-
blems. It will have to be extended to
multiple precision.
The coding to implement the routine is
given below. While the addresses are
given for the KIM-1, a few address
changes should make it possible to im-
plement this routine on any other 6502
based system. The number you want the
square root of goes In location 0001,
then set the address to 0000 and GO.
The answer will be displayed In POINTH,
the left two LEDs of the KIM display. The
code given is probably not optimum — I
am a relative newcomer to machine
language coding. If you come with an im-
proved version of this routine, I'd ap-
preciate receiving a copy of it. The exam-
ple shown is set to take the square root
of $10.
18:30
MICRO — The 6502 Journal
November, 1979
START
STORE 1
MEM
STORE IN
Y REGISTER
^
SUBTRACT MEM
FROM ACCUM
YES
MOVE Y TO
POINT H
ADD 1 TO
Y REGISTER
^
ADD 2 TO
MEM
Flowchart
COOC:
cnio:
G02G:
GC:0:
GG-^iC:
0050:
000 G
GC6G:
G07C:
0000
CCiC:
COCO
GOSC:
OGOC
1 DC :
G'lC:
OOCC
A 9
10
G120:
C0C2
AC
01
0130:
one 4
re
lA
ri4C:
AG
CO
CISC:
0160;
GO Of
CI 70:
000 a
E5
lA
CIFC:
CCOb
30
nC:
Ci9C:
GOOD
C?
C2GG:
OCOE
EG
lA
0210:
001
E6
lA
C220:
0012
4C
00 CO
0230:
0240:
0015
84
FB
G25C:
001 7
4C
4F IC
0260:
1D=
;COAKE RGGT SGLTINE
aFRED J. BEUEY
:eg
fOOCG
NIEM
lA'
SCGIA
POIFTH
»'-
$COFB
START
'k
S1C4F
EEGIK
LCATM
SIC
LEYTM
?G]
riu:
T.DYTM
f pn
LGCP
SEC
OBC
KEN
El-: I
CTGF
I EY
INC
^iE^,
I EC
^iEM
JMF
LGCP
STCP
STY
FCII'TE
JXP
OTAKT
KIM/SYM/AIM-65-32K EXPANDABLE RAM
DYNAMIC RAM WITH ON BOARD TRANSPARANT REFRESH
THAT IS COMPATIBLE WITH KIM/ SYM/AIM-65
AND OTHER 6502 BASED MICROCOMPUTERS.
Beta computer devices
P.O. BOX 3«:S
ORANGE, CALIFORNIA 92665
^^^'^) 633-72E0
♦ PLUG COMPATIBLE WITH KIM.'SVM/AIM-65.
MAYBE CONNECTEDTOPETUSINGADAPTOR
CABLE. S&44-E BUS EDGE CONNECTOR.
♦ USES *5V ONLY (SUPPLIED FROM HOST
COMPUTER BUS). 4 WATTS MAXIMUM.
♦ BOARD ADDRESSABLE IN 4K BYTE BLOCKS
WHICH CAN BE INDEPENDENTLY PLACED ON
4K BYTE BOUNDARIES ANYWHERE IN A 64K
BYTE ADDRESS SPACE.
♦ BUS BUFFERED WITH 1 LS TTL LCIAD.
♦ 200NSEC 4116 RAMS.
♦ FULL DOCUMENTATION
♦ ASSEMBLED AND TESTED BOARDS ARE
GUARANTEED FOR ONE YEAR, AND
PURCHASE PRICE IS FULLY REFUNDABLE IF
BOARD IS RETURNED UNDAMAGED WITHIN
14 DAYS.
ASSEMBLED/
TESTED
KIT
WITH 32K RAM 1495.00 1459.00
WITH 16K RAM I425ilfl J3B9.00
WITHOUT RAM CHIPS t3S5ilO S3I9.00
HARD TO GET PARTS ONLY (NO RAM CHIPS) 1180,00
BARE BOARD AND MANUAL S85.D0
m iWTEBa! m u
CONNECTS THE ABOVE 32K EXPANDABLE MM TO A 4K OR 8K PET.
CONTAINS EXPANSION INTERFACE CABLE. BOARD STANDOFFS.
POWER SUPPLY MODIFICATION KIT AND MMPLETE INSTRUCTIONS.
ALL ASSEMBLED BOAROS AND MEM-
ORY CHIPS CARRY A FULL ONE YEAR
REPLACEMENT WARANTY.
16K XI DYNAMIC RAM
THE MK4116-3 IS A 16,384 BIT HIGH SPEED
NMOS, DYNAMIC RAM. THEY ARE EQUIVALENT
TO THE MOSTEK, TEXAS INSTRUMENTS, OR
MOTOROU 4116-3.
♦ 200 NSEC ACCESS TIME, 375 NSEC CYCLE
TIME.
♦ 16 PIN TTL COMPATIBLE
♦ BURNED IN AND FULLY TESTED.
♦ PARTS REPLACEMENT GUARANTEED FOR
ONE YEAR.
t9.SOEACHIII0UAIITITIES0Fa
MOTOROLA MEMORY ADDRESS MULTIPLEXER-
MC3242A
THE MC 3242A IS AN ADDRESS MULTIPLEXER
AND REFRESH COUNTER FOR 16 PIN, 16K
DYNAMIC RAMS THAT REQUIRE A 128 CYCLE
REFRESH,
♦ CONTAINS MEMORY REFRESH COUNTER.
♦ MULTIPLEXES SYSTEM 14 BIT ADDRESS TO
THE 7 ADDRESS PINS OF THE RAMS.
♦ COMPATIBLE WITH 3480 MEMORY
CONTROLLER.
♦ PART IS GUARANTEED.
tl2iOEACH
MOTOROU OVRAMIC MEMORY CORTROLLER-
MC34e<IL
MEMORY CONTROLLER DESIGNEDTOSIMPLIFY
CONTROL OF 16 PIN 4K OR 16K DYNAMIC RAMS.
♦ GENERATES RAS/CAS ANO REFRESH TIMING
SIGNALS FOR 16K TO 64K BYTE MEMORIES.
♦ GENERATES MEMORY READ/WRITE TIMING.
♦ DIRECT INTERFACE WITH MOTOROLA OR
INTEL 3242A ADDRESS MUX AND REFRESH
COUNTER.
♦ PART GUARANTEED.
tISJSEACH
6502. 64K BYTE RAM AND CONTROLLER SET
MAKE 64K BYTE MEMORY FOR YOUR 6800 Ofl
6502. THIS CHIP SET INCLUDES:
♦ 32M5K4116-3 16KX1, 200 NSEC RAMS.
♦ 1 MC3480 MEMORY CONTROLLER.
♦ 1MC3242A MEMORY ADDRESS
MULTIPLEXER AND COUNTER.
♦ DATA ANO APPLICATION SHEETS. PARTS
TESTED AND GUARANTEED.
1325.00 PER SET
EPflOM
2716-450NSEC MO.OO
bppiG
computer
Apple ir Reference Manual $10.00
Apple soft Manual 10.00
Programmer's Guide (Computer Station) 5.95
Apple II Monitor Peeled 9.95
Software Directory for Apple
• Business, Finance & utility 4.95
• Games, Demo, utility 4.95
Best of Contact 78 2.50
programming in PASCAL (Crogono) 9.90
INTCRFACC CARDS
Prototvping/ HObbv Card
Parallel Printer interface card
Communications card a 0B3S
Connector Cable
High-Speed serial interface Card
Language System with Pascal
(48K RAM I Disk II ReQulredi
Applesoft 11 Firmware card
16 input Analog Card
49500
200 00
295 00
ACCESSORIES
Disk II— Drive Only
Disk II— Drive a controller (32K Uln
RAM Recommended)
vinyl Carrying Case
Tape Recorder
Programmers Aid NO- 1 Firmware (For
use with Integer basio
Clock /calendar card
Auto— start ROM Package (For
Apple II Only)
Dtglkltlzer Pad hy Taios
(Kltformi . 499 00
High Resolution Light Pen 199.00
Micromodem (I3.C. Hayesi 379.00
12" B/w LeeDe:i Monitor 149 00
Cable from Monitor to Apple ll 9.95
13' Color TV Compatible with
Apple fl 290 00
Sup-R-Moduiatiir IRF) 25.00
SOFTWARE FOC: APPL£ II
PASCAL from Piogramma 49.95
FORTH 49.95
LISP— from Apple software Bk NO. s n/c
LISA- Interactive disk assembler 34 95
WHATSIT— Excellent conversational data
base manager 32K 100.00 4flK 125 00
SARCON-Champ of 2nd west Coast
ComputerFalre 19.95
APPLE PIE— EXCi>llent text editor 24.95
FORTE— Music editor In hires 19.95
FASTCAMMON- Excellent backgammon
game with gniphlcs Tape 20.00 Disk 25.00
APPLE 21 -Excellent blackjack game 9.95
BRIDGE CHALLEriCER— Computer bridge 14 95
FINANCIAL MANAGEMENT SYSTEM
• Accounts payable • Ledger Processing
• Accounts Receivable • Payroll
• Inventory Control • S800 Complete
• S200 Each package • S10 for Manual
PRINTER SPECIi^LS FOR APPLE AND PET
TRENDCOM 100 with Interface for
Apple or PET 450 00
LITE PEN used with TV or monitor
screen j4 95
ALF Music Synthesizer Boards 265 00
supertalker 279 00
Anadex DP-8000 with tracter
8 ' paper width and Interface
to Apple 1050 00
Centronics 779-2 for Apple ll
with parallel interface 1 24S oo
SOFTWARE (Send For complete software
catalog $1.00)
Dow Jones Portfolio Evaluator /
Stock Ouote Reporter Disk so oo
Microchess 2.0 Chess Disk 2S oo
Disk utility Pack with DOS 3 2 25 00
The Controller (General Business
Systeml 625 00
Apple Post (Mailing List Systemi 49 95
Bowling Program Diskette- 1 5 00
The Cashier (Retail Store Management 250 00
Checkbook cassette 20 oo
Applesoft 11 Language & Demo
cassette 20 00
RAM Test Tape with Manual 7 so
Finance 1-2 cassette Package 25 00
oatamover/Telepong cassette
(Com. Card & Modem Req di 7 SO
Microchess 2.0 Chess Tape 20 oo
Bowling Program Tape 1 s oo
Pascal with Language System
(48K RAM i Disk II Required) <I9S 00
495 00
595.00
30 00
40.00
6S.00
New for Apple Computer Owners
at Low ComputerWorld Prices
8" Disk Drives witli liousing $1295.00 for single drive $1895.00 for dual drive
d
A PROFESSIONAL
BUSINESS SYSTEM
<^
CMB 2022
$995
TM
commodore
CBM
2001-8 $795
2001 -16N . $995
2001-32N . . SI 295
2001 -32B . . $1295
External
Cassette $95
PET to IEEE
cable $39.95
CBM 2023
Printer $849
IEEE to IEEE
Cable $49.95
Join Now
CBM 2040
$1295
2001 -16B
$995
Commodons PET service Kit $30.00
Beeper— Tells when tape is Loaded 24.95
Petunia— Plav music with PET 29.95
video Buffer— Attach another display 29.95
Combo— petunia and Video Buffer 49.95
SOFTWARE FOR PET
iMirrorsand Lenses 19.95
The States 14.95
Real Estate i a 2 59.95
iMomentumand Energy .19.95
Projectile Motion 19.95
Mortgage 14.95
DOW Jones 7.95
Petunia Player Sftwr . . . .14.95
Checkers and Baccarat 7.95
Chess 19.95
Series and Parallel
Circuit Analysis 19.95
Home Accounting 9.95
BASIC Math 29.95
Came Playing with basic
vol. I, II, III 9.95 each
Become a member of ComputerWorld's RAYGAMCO Computer Discount Club.
By being a RAYGAMCO Member you receive substantial discounts on every item you purchase,
including all hardware, software, accessories, even books and paper! You will also receive a
monthly newsletter with ail the latest available for your particular computer system, and much,
much more — exclusive to RAYGAMCO Members only!
Here's how to join.
IMothing to buy. Simply complete the self-addressed postcard in this magazine with name,
address, and your computer system. You'll receive your personalized RAYGAMCO Computer
Discount Club Membership Card in the mail with information on how to use your card when
ordering for big savings!
Chiarter RAYGAIVICO IVIembers' Special. Join now and receive 20% OFF of any purchase.*
■20% offer expiras December 24, 1979. Offer is valid for RAYGAMCO Members only.
ComputerWorld
A RAYGAM COMPANY
6791 Westminster Ave., Westminster, CA 92683 (714) 891-2587
WANTED: ATARI'
• • • FIND IT AT COMPUTER WORLD.
ATARI® 800^"
PERSONAL COMPUTER SYSTEM
PRICE INCLUDES:
Computer console
BASIC Language Cartridge
Education System Master Cartridge
BASIC Language Programming
Manual (Wiley)
800 Operator's Manual with Note Book
ATARI 410 Program Recorder
Guide to BASIC Programming Cassette
8K RAM Module-Power Supply*
TV Switch BOX
$99999
ATARI® 400™
PERSONAL COMPUTER
SYSTEM
PRICE INCLUDES:
Computer Console
BASIC Language Cartridge
BASIC Language Programming
Manual (Wiley)
400 Operator's Manual with
Note Bool(
Power Supply
TV Switch Box
5549
99
PERIPHERALS AND ACCESSORIES
ATARI' 810™
DISC DRIVE*
DISKETTES
CX8IOO BLANK DISKETTES'
CX8101 DISK FILE MANAGER*
$5.00/ea.
$749.99
ATARI^ 820™
PRINTER*
$599.99
ACCESSORY CONTROLLERS
CX2C-01 DRIVING CONTROLLER PAIR
CX50-04 PADDLE CONTROLLER PAIR
CX40-04 JOYSTICK CONTROLLER PAIR
S19.95/ea.
ATARI® aiO™
PROGRAM RECORDER $89.99
ADD-ON MEMORY (800 ONLY)
CXS53 8K RAM MEMORY MODULE
CX8S3 16K RAM MEMORY MODULE
S124.99
$249.99
ROM CARTRIDGES
CXL4001 EDUCATION SYSTEM MASTER
CARTRIDGE $34.99
KEY: ij) = uses joystick controller
ip) = uses paddle controller
Id) = uses driving controller
SOFTWARE
GAMES $49.99/ea.
CXL4004 BASKETBALL ())
CXL4005 LIFE (|)
CXL4006 SUPER BREAKOUTTM |p)
CX4008 SUPER BUGTM'V Id)
APPUCATION $69.99
CXL4002 ATARI BASIC
CXL4005 ASSEMBLER DEBUG"
CXL4007 MUSIC COMPOSER
CXL4009 COMPUTER CHESS" (|)
EDUCATION SYSTEM CASSETTE PROGRAMS
$39.99/ea.
CX6001 US. HISTORY
CX60O2 U.S. GOVERNMENT
CX6003 SUPERVISORY SKILLS
CX6004 WORLD HISTORY (WESTERN)
CX6005 BASIC SOCIOLOGY
CX6(X)6 COUNSELING PROCEDURES
CX6007 PRINCIPLES OF ACCOUNTING
CX6008 PHYSICS
CX6009 GREAT CLASSICS (ENGLISH)
CX6010 BUSINESS COMMUNICATIONS
CX60I1 BASIC PSYCHOLOGY
CX6012 EFFEaiVE WRITING
CX6013 AUTO MECHANICS
CX6014 PRINCIPLES OF ECONOMICS
CX6015 SPELLING
CX6016 BASIC ELECTRICITY
CX601 7 BASIC ALGEBRA
BASIC GAME AND
PROGRAM CASSETTES
CX4101 GUIDE TO BASIC PROGRAMMING'
CX4102 BASIC CAME PROGRAMS'
S29.95/ea.
'OctoBer Delivery "NovemBer Delivery
—Prices subject to change.-
We Promise to Deliver!
• We GUARANTEE ship dates on prepaid Computer System orders.*
• If for reasons beyond our control we miss a ship date, WE WILL REFUND THE SHIPPING
AND HANDLING CHARGES TO YOU — PLUS GIVE YOU A 10% DISCOUNT ON YOUR
NEXT PURCHASE OF ANY ATARI SOFTWARE!
• For prepaid Computer System orders, you'll receive an Accessory Controller of your choice.
'All prepaid orders must be for full amount by Cashier's Chect< only, payable to ComputerWorld California residents, please add 6% sales tax.
ORDERING INFORMATION:
TELEX 182274
1. Type or print item(s) you wish to orider.
2. If you pay by personal check: please allow 2 weeks for personal check to clear
3. If you pay with bank carij: We accept VISA, BankAmericarid, MasterCharge. Please incluide bank card number,
card expiration date, and your signature.
4. Add 50' for postage and handling of books, manuals, catalogs, and magazines. Add $10.00 for shipping,
handling, and insurance for hardware and systems orders.
5. Send orders to ComputerWorld, 6791 Westminster Ave., Westminster, CA 92683. California residents, please add
6% sales tax.
ComputerWorld
A RA\GAM COMPANY
6791 Westminster Ave., Westminster, C A 92683 (714) 891-2587
QUICK CHANGE ARTISTRY
ENGINEERED SPECIFICALLY FOR
THEKIM-1 MICROCOMPUTER
• Protection of Chips and
Other Components
• Viewing Angle of Readout
Enhanced
• Improved Keyboard Position
for Easier Operation
EASILY ASSEMBLED
• Absolutely No
Alteration of KIM-1 Required
• All Fasteners Provided
• Goes Together in Minutes
with a Small Screwdriver
ATTRACTIVE FUNCTIONAL PACKAGE
• Professional Appearance
• Four Color Combinations
• Improves Man/Machine Interface
MADE OF HIGH IMPACT STRENGTH
THERMOFORMED PLASTIC
• KydexlOO-"
• Durable
• Molded-ln Color
• Non-Conductive
AVAILABLE FROM STOCK
• Allow Two to Three Weeks for
Processing and Delivery
• No COD'S Please
• Dealer Inquiries Invited
TO ORDER:
NAME
STREET
CITY
1. Fill in this Coupon (Print or Type Please)
2. Attach Checl< or Money Order and Mail to:
STATE
Please Ship Prepaid
@ $23.50 Each
ZIP
-SKE1-1(s)
the
enclosures
group
771 bush street, san francisco 94108
Color Desired blue D beige D
blacl< D white □
California Residents please pay
$25.03 (Includes Sales Tax)
''• TM Rohm & Haas
Patent Applied For
TSAR: A Time Sharing Administrative
Routine for the KIIVI-I
if you thinl( the KliVI-1 is too smaii to do interesting jobs,
then consider this program. TSAR is a super monitor
which supports time-sharing, opening the door to a wide
variety of new capabiiities. The techniques can easily
be translated for use on other computers.
Philip K. Hooper
3 Washington Street
Northfleld, VT 05663
J
The program presented here takes
over supervisory control of the KIM-1,
demoting the KiM monitor to the role of
"just another program" sharing execu-
tion time with a list of user programs.
The monitor, with Its display and
keypad, remains available while user
programs are running, permitting true
"front panel" operation; examination
and even alteration of memory during
program execution. There is provision
for inserting breakpoints into a program
while it is running, as well as a TSAR-
compatible breakpoint servicing routine.
Although the system as presented is
configured for six programs, in addition
to the monitor and TSAR itself, it is easi-
ly expanded to provide supervision for
as many user programs as memory and
stack requirements permit.
Introduction
Not long ago, if anyone had sug-
gested to me that I should write a time-
sharing system for my KIM-I, I would
have objected on two counts: first, that
it would be pointless with such a small,
single-user system; second, that it
would be far too complicated to design,
implement, and operate. I would have
been wrong on both counts.
I had been working on a design
problem — the problem of providing a
perfectly transparent operating environ-
ment for my TVT-6 video board. This in-
expensive and very versatile board
draws its timing signals directly from
the address bus of the MPU and can not
function normally without the full, undi-
vided attention of KIM, making its use
along with another program rather awk-
ward to orchestrate.
When I had finally tamed the micro-
seconds and sync pulses and had my
transparent display operational, I loaded
my LIFE program and settled back,
regarding the result with satisfaction
and noting how cooperative it all seem-
ed, with the display driver and LIFE pro-
gram sharing the time of the MPU. And
then it hit mel This was already a
timesharing system. Moreover, leaving
out the TVT-6 would let me streamline
the system and also extend it to the
supervision of many "simultaneous"
programs.
Before explaining the operation of the
system, let me note resources the
system requires as well as some of the
features it offers. Its needs are few: an
unexpanded KIM-1 provides sufficient
memory for overseeing the operation of
thirty-some programs; the supervisory
routine, TSAR, resides in forty-four bytes
of page twenty-three; a special, and op-
tional, breakpoint routine occupies
another fifteen bytes on thai: page; fif-
teen page zero locations are required for
storing system variables under a six-
user-program configuration (with two
additional bytes needed for each pro-
gram over six); and page one is
distributed as stack space for the
various programs.
The only hardware expansion needed
is a wire, or possibly a switch, allowing
the interval timer to send an interrupt to
the MPU. (See Figure 1.) A speaker, con-
nected as in the Kim User Manual, can
provide dramatic examples of the sys-
tem's use, but is certainly not essential
to its operation.
The most useful aspect of the system
is, in my opinion, provision for a full hex
front panel. Under the KIM monitor, the
keypad and display are used almost ex-
clusively to enter and Initiate programs.
Though individual programs may use
them for special purposes, they general-
ly remain idle during program execution.
Under TSAR, however, the monitor is
timeshared and becomes a monitor in
the full sense of the word, remaining ac-
tive while other programs are executing.
This permits the on-line examination
(and even alteration) of any memory
location, so that one can, for instance:
watch a counter as it approaches zero,
alter the value of a byte of data to deter-
mine its effect on the program, or even
change an instruction opcode, all while
the program is running! Essentially it
brings full interaction to KIM-1, letting
the user and running programs interact
through the services of the monitor.
The cost of this continuous monitor-
ing is time— the user programs run more
slowly when timeshared— but there are
occasions, as during certain program
development stages, where this can be
an advantage. By using this system with
five dummy programs having large time
slices, we produce an interactive slow-
stepper. By letting the programs modify
each other's time slices (an unnatural
activity recommended only for produc-
ing unpredictable results) we can create
an enormous variety of unusual timing
patterns.
The Timesharing Procedure
The 6502 provides ready access to and
manipulation of the stack pointer, and
this in turn permits the realization of a
fairly simple timesharing procedure. The
programs to be run are placed in a queue
and are activated and recalled by TSAR
as it cycles through the queue. So TSAR
can keep adequate track of these pro-
grams, each has its own stack area,
stack pointer, and time slice determin-
ing how long the program will be active
when its turn comes. The user selects
the stack areas from page one, while the
corresponding stack pointers and the
time slices are kept in two page zero
lists, STAX and TIMES respectively. The
index number (position in the queue) of
the program currently executing is
stored in location INDEX. Figure 2 il-
lustrates this procedure.
Assume that one of these programs,
say P2, is running. Under TSAR, the in-
terval timer will also be running, and
armed, loaded initially with the time
slice for P2 from TIMES -i- 2. At "time
out," TSAR will be re-entered at location
1780, via the NMI vector, and after
disabling further interrupts TSAR will
save registers A, X, and Y on the stack
reserved for P2. P and PC have already
been saved there, as part of the interrupt
response of the 6502. TSAR will then
November, 1979
■MICRO — The 6502 Journal
18:35
PB7
IRQ
d
mi
A-15
K I M
E-6 E-H
h
Figure 1: Enabling the timer interrupts. A SPDT switch connecting
PB7 to either NMI or IRQ permits the fullest realization of TSAR's
capability. The switch setting should not be changed without first
setting both interrupt vectors to point to the monitor.
replace the stack pointer value for P2 in
STAX + 2, the second position of the
ST AX list. This procedure is illustrated in
Figure 3.
Disabling further interrupts at this
time has no effect on the minimal con-
figuration but is adviseable if there are
other devices that could pull IRQ low
connected to the system, to inhibit inter-
rupts from them during operation of the
supervisory routine.
Program 2 now remains idle until IN-
DEX again assumes the value of 2.
Before that occurs, TSAR will have look-
ed at six other INDEX values; activated
and later recalled those programs cur-
rently enabled — those with non-zero
time slices; kept the monitor enabled;
and maintained STAX as needed. At any
rate, when INDEX = 2 does recur, the
time slice for P2 will be brought in from
TIMES -I- 2 and examined by TSAR. If this
is zero, P2 is disabled and will be passed
by. Otherwise, this time slice will be writ-
ten to the timer, to initiate another time
period during which P2 may execute.
Next, the stack pointer specific to P2
will be brought back from STAX -i- 2 and
used to access P2's private stack, from
which the saved values of the Y, X, and A
registers will be pulled. Finally, an RTI
* TSAR
: BY PHILIP
* MODIFIED 7
4
-19-79
17BC
COUNT
$0000
17BC
X
$0300
17BC
INDEX
$00E0
17BC
TIMES
$00E1
17BC
STAX
$00E3
17BC
POINTL
$OOFA
17BC
TIMER
$170E
17BC
DELAY
$1ED1
I7BC
INCPT
$1F63
1780
ORG
$1780
1780 78
ENTER
SEI
1781 H8
PHA
1782 8A
TXA
1783 18
PHA
17814 98
TYA
1785 18
PHA
1786 BA
TSX
1787 A1
EG
LDY
INDEX
1785 96
E8
STXZY
STAX
178B A5
El
LDA
TIMES
178D DO
02
BNE
INDEC
178F C6
El
DEC
TIMES
1791 C6
EO
INDEC
DEC
INDEX
1793 10
01
BPL
TINDX
1795 AO
06
LDYIM
$06
1797 81
EO
STY
INDEX
1799 A6
EO
TINDX
LDX
INDEX
179B B5
El
LDAX
TIMES
179D FO
F2
BEQ
INDEC
179F 8D
OE 1"
STA
TIMER
17A2 B5
E6
LDAX
STAX
HAM AA
TAX
17A5 9A
TXS
17A6 68
PLA
17A7 a8
TAY
17A8 68
PLA
17A9 AA
TAX
17AA 68
PLA
17AB 40
LEAVE
RTI
K. HOOPER
19-79 BY MICRO STAFF
PLEASE DO NOT DISTURB
PLACE
ALL
REGISTERS
ON THE
STACK
GET CURRENT STACK POINTER FROM MPU
NOW, WHICH PROGRAM IS RECALLED?
STASH STACK POINTER FOR INTERRUPTED PROGRAM
EXAMINE TIMING CONSTANT OF MONITOR
IF ZERO, MONITOR DISABLED - MUST RESTORE
RESET MONITOR TIME SLICE
DECREMENT INDEX TO NEXT PROGRAM
POSITIVE DENOTES VALID INDEX
OTHERWISE, RESET INDEX TO POINT TO THE
GREATEST PROGRAM QUEUE INDEX
TENTATIVE INDEX OF NEXT PROGRAM
FETCH PROGRAM TIME SLICE
IF ZERO, PROGRAM DISABLED - PICK ANOTHER
DEPOSIT TIMING INTERVAL IN COUNTER - ENABLE INT
FETCH STACK POINTER FOR REACTIVATED PROGRAM
PUT STACK POINTER IN X REGISTER
AND DEPOSIT STACK POINTER INTO MPU
BRING
IN
REGISTERS
OFF
STACK
RETURN TO THE PROGRAM
will draw the status register and pro-
gram counter from this same stack, and
P2 will be off and running again, from
the very place at which it was inter-
rupted. If no other program interferes
with its storage areas, P2 will function
as though it were the only program in the
KIM, although a bit more slowly.
In a small system like this, without
software-initiated memory protect or
disk-based page swapping, any unwant-
ed interaction between programs must
be prevented by the programmer. This is
managed through carefully planned
memory allocation and through the use
of stack storage to make any shared
routines fully reentrant— using different
storage areas (stacks) depending on
which program is using the routine.
Therefore, whenever the monitor is in-
cluded as an enabled program, the
monitor subroutines which use RAM
temporary storage and those which
serve the monitor's keypad and display
routines should not be called by a user
program. The results would be unpre-
dictable and would probably prevent in-
teractive use of the monitor.
This sequence of execution, interrup-
tion, dormancy, reactivation is followed
by all programs on the queue, including
the monitor. Depending on its time slice,
each enabled program receives from 64
to 16320 microseconds of execution
time, minus TSAR's overhead, when its
turn arrives, while those disabled by a
null time slice are simply passed over.
With six programs enabled in addition to
the monitor, TSAR exacts roughly 80
microseconds to process each interrupt,
and each disabled program increases
this by about 20 microseconds to a max-
imum of 200 with the monitor alone
enabled. The more work the system has
to do, the more efficient it becomes! Of
the above times, 30 microseconds is
taken from the time slice of the program
being reactivated, so that a time slice of
01, representing a single sixty-four
microsecond portion, will actually pro-
vide thirty-four microseconds of execu-
tion time for the program, each time
around.
A time slice range of from 1024 to
261,120 microseconds can be installed
by replacing the value of the byte at
17A0 with "OF", which starts the timer's
counter in the divide-by-1024 mode in-
stead of the divide-by-64 mode. Although
this reduces the relative time penalty
charged by TSAR, it also degrades the
response of the monitor somewhat.
Oddly enough, this is an example of
one of the peculiar charms of the TSAR
system. Some of the aggrevations that
TSAR introduces — monitor response an-
noyingly slow at times, startup routine
hard to remember, recovery from a crash
a major undertaking — all of these pro-
vide the peculiar sensation that one is
working on some sort of monster sys-
tem and not just a KIM-1 with IK of
memory and a 50-odd byte timesharing
supervisor.
18:36
MICRO — The 6502 Journal
November, 1979
The code for this procedure is
presented in the listing. Note that the
sections of code for the normal (inter-
rupt to 1C00) entry and normal ("GO"
-1DC8) exit for the ROM monitor are
closely related to the entry and exit code
for TSAR. Both involve storing, and later
retrieving, the contents of the PCH, PCL,
P, A, Y, X, and SP registers, which to-
gether completely specify the internal
state of the MPU. However, while the
monitor stores these values in fixed,
page zero locations, TSAR places them
in a user stack reserved for the par-
ticular program which has just been
recalled.
Using the monitor as the operating
system, the user can alter these zero
page locations holding register values,
malting It possible to exit from the
monitor to a different program, with a
different set of operating parameters,
than the program that was running
before. TSAR does this automatically,
by pulling the register values from a dif-
ferent stack, the one corresponding to
the program about to be activated,
rather than from the stack for the pro-
gram which was just recalled.
INDEX
INDEX
VALUES
TIMES
STAX
PAHAMETERS
FOR:
INDEX (QOEO)
TIMES OOEl)
STAX (0OE8)
30
01
02
03
04
05
06
OOEl
00E2
00E3
0OE4
Q0E5
00E6
OQE?
0OE8
00E9
OOEA
OOEB
OOEC
OOED
OOEE
LIST OF
TI.XE SLICES
LIST OF
STACK POINTERS
MON-
ITOR
PROG
1
PROG
2
PROG
3
PROG
4
PROG
5
PROG
6
holds the number assigned to the program currently active
and is used as an offset to retrieve information from...
02EA 4C EG 02
» SAMPLE PROGRAMS FOR EXERCISING TSAR »
» 1ST SAMPLE PROGRAM MERELY COUNTS, IN HEX, THE NUMBER
» OF TIMES IT IS ACTIVATED, STORING THE COUNT IN $0000,
» HHICH SHOULD BE PRESET MANUALLY TO ZERO
CLEAR ACCUMULATOR AND USE IT TO
ZERO OUT THE MONITOR TIME SLICE
FETCH THE MONITOR TIME SLICE, AND REMAIN IN
THIS LOOP AS LONG AS IT IS ZERO
RECORD THE CHANGE, WHICH INDICATES
COMPLETION OF ANOTHER
CYCLE THROUGH THE QUEUE, AND REPEAT
02E0
ORG
$02E0
02E0 A9 00
START
LDAIM
$00
02E2 85 El
STA
TIMES
02E4 A5 El
LOOP
LDA
TIMES
02E6 FO FC
BEQ
LOOP
02E8 E6 00
INC
COUNT
JMP START
NOTE: USING THE MONITOR TIME SLICE AS A FLAG TO
INDICATE TO A PROGRAM WHEN IT HAS BEEN RECALLED
AND THEN REACTIVATED IS A USEFUL TRICK, BUT
AT A TIME
2ND SAMPLE PROGRAM ALSO COUNTS CYCLES, BUT IT
DOES SO IN BCD, KEEPING THE LEAST SIGNIFICANT
DIGITS IN 05FF, THE NEXT TWO IN 03FE,
AND SO ON. IT CAN COUNT VERY HIGH.
DECIMAL SPOKEN HERE
SET CARRY SO ADDER WILL WORK PROPERLY
SET X REGISTER TO ZERO TO
ZERO THE MONITOR TIME SLICE
CHECK MONITOR TIME SLICE AND,
IF IT IS ZERO, KEEP ON CHECKIN '
TO FF, TO INDEX, INITIALLY, 03FF
GET CONTENTS OF 03XX
ADD 1, SINCE THE CARRY IS SET
AND PUT IT BACK WHERE WE FOUND IT
WITHOUT CARRY, ADDITION IS FINISHED
SO WAIT TILL NEXT TIME, OTHERWISE
BACK U^ TO NEXT DIGIT 4 PROPAGATE CARRY
NOTE: THIS PROGRAM MAY BE USED WITH THE PREVIOUS
PROGRAM BY HAVING ONLY ONE OF THEM MESS WITH
TIMES AND HAVING THEM SHARE A RAM LOCATION AS
A FLAG. ONE SETS THE FLAG, WHILE THE OTHER
RESETS THE FLAG AND LOOPS.
which is a list of seven time slices, for six use."
programs and the monitor, and from...
which is a list of the seven staolc pointers for these
progra.DS.
Figure 2: Use of page zero memory, QOEQ-OOEE
While the monitor uses a single loca-
tion, 00F2, for storing its only stack
pointer, TSAR maintains a list, STAX, of
stack pointers, one for each program on
the queue. The six bytes of code from
178B to 1790 were included as an after-
thought, after several foolish blunders
on my part had let the system escape
from my control. They merely guarantee
the monitor's presence by forcing its
time slice to "FF" If it is ever found at
"00". Resorting to reset, to restore the
monitor, is fun the first few times only.
Nonetheless, these six bytes and the fif-
teen bytes used to service breakpoints
may be deleted without otherwise affec-
ting TSAR.
Bringing Up The System
Managing the TSAR system is quite a
bit more complex than running a single
program on the KIM, and several steps
are required to put It into operation. The
following sequence will generate a func-
tioning TSAR system.
0200
ORG
$0200
0200
F8
START2
SED
0201
33
STALL
SEC
0202
A2
00
LDXIM
$00
0204
86
El
STX
TIMES
0206
A5
El
L00P2
LDA
TIMES
0208
FO
FC
BEQ
L00P2
020A
CA
NEXT
DEX
020B
BD
00 03
LDAX
X
020E
69
00
ADCIM
$00
0210
9D
00 03
STAX
X
0213
90
EC
BCC
STALL
0215
BO
F3
BCS
NEXT
1. Verify that PB7 is connected to
NMI (Figure 1).
2. Load TSAR into 1780-1 7BB, from
keypad or tape.
3. If loading was from the keypad,
verify correctness of code.
4. Set 17FA,B to point to 1780 and
set 17FE,F to point to 17AC, pro-
viding the proper interrupt vec-
tors for TSAR.
5. Load all locations from OOEO
through 00F1 with "00".
6. Press "RS", guaranteeing the
stack pointer (monitor) at FF. If
you are planning to use the DE-
LAY subroutine from the ROM,
November, 1979
MICRO — The 6502 Journal
18:37
The monitor or a
user program will
execute until its
time slice has been
exhausted, at which
time the interval
timer generates an
interrupt which
returns control to
TSAR, where the
current program is
retired and the
next enabled program
is activated
Disable interrupts
timer times out
RTI to next program on li;
i
2ave all registers
'
Store stack pointer
1
Protect monitor
i
Select next program
i
Load and arm timer
A
Retrieve new pointer
i
t
Restore all registers
that is enabled
n
Monitor or user program
running under supervisio
of TSAR.
The activities of TSAR as
it supervises the system.
Figure 3: Flow of control in the TSAR system.
Table 1
Register Value Storage by the TSAR and by the KIM Monitor
Monitor
Dedicated KIM
Page Zero RAM Locs.
00F4
OOFS
00F3
00F1
00 EF (OOF A)
OOFO (OOFB)
Interrupt entry to TSAR (at 1780) or the Monitor (at 1C00) will store the MPU
registers in the locations indicated above. Leaving TSAR via an RTI will restore
these values to the MPU. Leaving the Monitor by using 'GO' restores the MPU
from these RAM locations, except that the PCL and PCH are loaded from OOFA
and OOFB (the pointer), respectively. To replace the original program counter Into
the MPU, the contents of OOEF and OOFO are first transferred to OOFA and OOFB by
pressing the 'PC key, moving the Program Counter into the pointer.
TSAR
KIM
Typical User
Stack Locations
Prog
ram
Register
Saved
01 DA
01 DB
01 DC
01 DD
01 DE
01 DF
Y
X
A
P
PCL
PCH
Initial
t
value
Initial
X
value
Initial
A
value
Initial
flag
values
Initial
PCL
(EO)
Initial
PCH
(02)
01D9
OlDA
01DE
01DF
Figure 1: Initialization of a user program stack. The stack pointer Initially
points to 01D9, but since It is incremented before any values are pulled, the
contents of 01D9 have no effect on the program.
remember that reset puts 17F3
to "FF". Also, if you are inten-
ding to use either port A or port
B for output, you must recon-
figure at this time, since reset
configures all port lines as in-
puts.
7. Examine address 00E1, the
monitor time slice. It will be
"00".
8. Press "ST", NOT "GO"! we in-
tentionally interrupt the monitor
at this point to raise the activity
to the TSAR system level. The
valjje at 00E1 should now
become "FF" as the monitor pro-
tection routine leaps in. If this
does not happen, briefly address
location 170C, another way to
get an NMI pulse, and return to
viewOOEI. If it still does not read
"FF", reset and check the star-
tup sequence.
9. Now, assuming 00E1 is at "FF",
try to key in "00". If the system
rejects this, keeping "FF" in-
stead, timesharing is in opera-
tion. If "00" is accepted in 00E1,
generate another NMI (by ex-
amining 170C again) and verify
timesharing as above.
10. As a final indication that time-
sharing is in operation, examine
00E8, the stack pointer for the
monitor. Since the monitor is be-
ing interrupted, and not always
at the same place, the value of
0OE8 should change, probably
flitting quickly from "F5" to "F7"
and back. Any sign of flickering
here verifies that TSAR Is in
charge and that timesharing is
under way.
11. Key in a user program, noting
that the monitor behaves as it
always has. If you intend to load
any user programs from tape, do
so before step 8, as the timing
changes under TSAR are not
compatible with serial I/O.
Assume that this first user pro-
gram starts at location 02E0, as
does the first of the sample pro-
grams, and that its stack ex-
tends downward from 01 DF,
leaving 32 bytes for the monitor,
far more than it will ever need.
This Is program 1 (the monitor Is
program 0), so its initial stack
pointer will go into STAX-i-1,
00E9. This stack will be access-
ed initially by lines 17A6 to 17AB
of TSAR. Since TSAR first pulls
register values for Y, X, and A,
and then (with RTI) pulls three
more values for P and PC, we
must provide these six values
immediately above the stack
pointer. The values in the first
four of these locations are used
for the initial register contents
when program 1 starts running.
18:38
MICRO ~ The 6502 Journal
November, 1979
As they are of no consequence
for the sample programs, they
may be set to "00" or left as
found. However, the final two
locations, 01 DE and 01 DF, hold
the program counter for program
1 and must, In this case, be In-
itialized to "EO" and "02"
respectively, to provide the star-
ting address, 02E0. Since the
stack pointer must initially point
to location 01 D9, a "D9" is keyed
into location 00E9.
12. Recheck the program code,
stack values, and stack pointer.
13. Examine location OOE2 (TIMES
+ 1), the time slice for program
1, and change it to a non-zero
value. If your program does
anything you can sense, you
should be sensing It now. If it
uses a counter, address the
counter and watch it move.
Return to 00E2 and vary the time
slice, noting how the program
execution speeds up and slows
down. Change 00E1 and note its
effect on the execution rate of
your program. Enjoy it for a
while, and then bring another
program into the system. The
procedure will be the same as
above, from step 11 on although
a different location must be us-
ed for the stack, different In-
itializing information must be
placed on the stack, and the new
stack pointer must be stored in a
different position of ST AX. Dis-
able the first program; run either,
both, or neither of them; play
with it!
You are MASTER of your own time-
sharing system! The sample programs
provided do not represent the full range
of TSAR'S potential. For one thing, keep-
ing the monitor on-line prevents
program-generated information from ap-
pearing on the display. With additional
devices for output, the variety of In-
teresting programs that can be run
under TSAR is increased greatly.
For example, a memory-mapped video
output can provide a very dramatic
visual demonstration of timesharing.
With a speaker connected as shown in
the Kim User Manual, several programs
may each toggle the speaker at rates
determined by DELAY, a KIM monitor
sub-routine at 1ED4 used for serial tele-
printer I/O but also useful whenever a
long software delay is required. They
may also alter the DELAY parameters,
VALUE AT
THE TIME
OF BREAK
ITS OWN
INDEX
(00)
p
FLAGS
B, Z, ETC
PCL
EITHER
B5 OR B7
PCH
t17)
X A P
THESE VALUES WERE STORED
WHEN THE BREAK OCCURRED
I 1
PCL PCH
THESE POINT TO THE
INSTRUCTION AFTER
BREAK OP-CODE
Loaded when timer interrupts breakpoint routine. Loaded when break actually occurs.
Figure 5: Breakpoint stack contents. After recall, the pointer addresses the location below the Y value.
0217
20 DU
IE
START3 JSR
021 A
20 63
IF
JSR
021D
A5 FA
LDA
021F
85 EH
STA
0221
40 17
02
JMP
3HD SAMPLE PROGRAM ADVANCES THE POINTER tOOFA,B)
TO DISPLAY SUCCESSIVE MEMORY LOCATIONS. IT
INTERFERES SEVERELY WITH THE SIMULTANEOUS USE OF THE
MONITOR KEYPAD AND DISPLAY.
DELAY (PRESET 17F2 AND 17F3 TO
DETERMINE RATE OF DELAY
INCPT INCREMENT THE POINTER, OOFA,B
POINTL GET THE LOW BYTE OF THE POINTER
AND USE IT AS THE VALUE
TIMES +03 VALUE OF THIS PROGRAM, SHOWN AS 3
STAHT3 AND KEEP GOING
NOTE: THIS PROGRAM BEHAVES UNPREDICTABLY. IT MIGHT
DISABLE ITSELF, OR IT MIGHT SUSPEND THE ENTIRE SYSTEM
OB IT MIGHT KNOT.
• BREAKPOINT SERVICE ROUTINE »
• (ENTRY FROM IRQ VECTOR)
17AC
ORG
$17AC
17AC n8
BREAK
PHA
SAVE A
17AD 8fl
TXA
AND X
17AE HS
PHA
ON THE STACK
17AF A9
00
LDAIM
$00
CLEAR A
17B1 A6
EO
LDX
INDEX
DETERMINE WHICH PROGRAM CAUSED BREAK
17B3 95
El
STAX
TIMES
AND DISABLE IT
17B5 B5
El
SLEEP
LDAX
TIMES
SLUMBER IN A LOOP UNTIL
17B7 FO
FC
BEQ
SLEEP
RECALLED BY TSAR
17B9 to
A8 1
I
JMP
GOBACK
LET TSAR RESTORE X AND A BEFORE RETURN
» NOTE: THE RTI CODE AT $178B (IN TSAR) IS EXECUTED
» TWICE AS A PROGRAM IS RE-AWAKENED AFTER A BREAK
(17F2,3), modify each other's time slices,
and toggle the speaker port between in-
put and output, producing a type of
mayhem In the speaker that varies from
WWII soundtracks, to tuba contests, to
bouncing ball bearings, to almost-
human-sounding arguments. Using "OF"
to provide longer time intervals
enhances this cacophony.
With several input devices (joysticks,
keypads, even push buttons), TSAR per-
mits the user connected to each device
to have apparently sole use of the
system, timesharing In the traditional,
multi-user sense. With suitable ground
rules established, the users could even
play a version of "core war" in which
each tries to get his (no doubt self-
relocating) program to destroy the other
programs before getting zapped by one
of them. This has a vaguely evolutionary,
survival-of-the-fittest undercurrent that
keeps it from becoming too abstract.
Keeping It Up
One problem the TSAR system does
present Is that, lacking proper safe-
guards, it is somewhat fragile. A single
program, running amok, can bring down
all of the others, including TSAR. For-
tunately there are some methods for re-
covering gracefully from crashes, and
even for averting many of them.
November, 1979
MICRO — The 6502 Journal
18:39
If the system seems to be misbehav-
ing, It is a good idea to locate and dis-
able the guilty program before it can in-
terfere with other programs, the monitor,
or TSAR. It is easy to disable any pro-
gram simply by setting its time slice to
zero. A record detailing what program is
where on the queue and where the
various stacks and stack pointers are
located is very useful here. Once a pro-
gram has been deactivated, it may be re-
placed on the queue with a different pro-
gram, or it may be altered (repaired?)
and then returned to service by a simple
time slice change.
If disabling the suspect program fails
to correct the system, the best pro-
cedure is to disable all user programs,
and the faster the better. Then re-intro-
duce them individually, testing them one
at a time with the monitor. An externally
generated IRQ signal is the quickest,
cleanest way to disable all user pro-
grams, as it invokes the breakpoint ser-
vice routine which disables the currently
active program in an orderly manner. An
interesting alternative is to have a
special "shutdown" program ready but
disabled. In case of trouble, enabling
this program sends it into action to dis-
able everything else and, finally, itself, in
an orderly manner.
Triggering IRQ several times will null
the time slices of all programs (monitor,
however, remains, because it is not sus-
ceptible to IRQ), leaving each in a
suspended state from which it can be
returned to service by simply changing
its time slice. This is a much less severe
insult to the system than a reset pro-
duces, and it should be tried first, when-
ever dysfunction is suspected. Of
course, if the system is hung in a loop
with the I flag set, IRQ will be ignored
and only a reset will affect the system.
If the system is 'hung', probably in-
dicated by a stable, partially-lit display,
the only option is a reset. Then, examine
INDEX (OOEO), to determine which pro-
gram was running at the time of the
reset interrupt. Disable that program
and, if it was the whole problem, a "hot
start" (set location OOEO to "00" and
then examine location 170C) should re-
kindle the system, minus the malfunctor.
You can next locate the stack pointer for
the disabled program and use it to deter-
mine the register contents (roughly)
when it was last activated. Compare this
with the response of the monitor at
reset, which sets both the stack pointer
and 00F2 to "FF", obliterating any
traces of stack activity.
Breakpoints
Unique to TSAR, the provision for in-
terrogating the code of a program while
it is running can even be extended
through the use of breakpoints, which
themselves may be inserted into the pro-
gram while it is running. This feature
depends upon the coincidental good for-
tune that each 6502 branch instruction
ends in a zero and can, therefore, be
shifted left to the break code "00"
without producing any dangerous inter-
mediate code.
Recall that the timesharing procedure
probably prevents entering, through the
monitor, more than one hex character
per time slice. For example, keying the
break code over the code "4C" would
first produce the interim code "CO"
which would create havoc If executed
before the second zero could be keyed
in, during the next monitor time period.
Changing a branch code, "XO", to a
break code presents no such problems.
Of course, there is the option of dis-
abling the program, inserting the break,
and reenabling it again; but inserting the
break into "moving code" is more ele-
gant and much more exciting.
When a break code is encountered, a
non-maskable IRQ is generated, vector-
ing control to the BSR code, presented
in the listing. This routine first saves the
A and X registers on the stack used by
the interrupted program. It then sets the
time slice of the interrupted program to
zero, and loops on this condition until
the current time slice expires and the
program is recalled by TSAR. The user
can detect the occurrence of a break by
watching the location holding its time
slice, or he can provide a watchdog pro-
gram to monitor this value and produce
a signal when it detects a zero. TSAR
will bypass this program on subsequent
cycles through the queue, because of its
null time slice, so the idle program, its
breakpoints, and its stack may be ex-
amined and altered at leisure, until it is
ready to be run again.
At that time, merely keying in a non-
zero time slice for the program signals
to TSAR that it is to be reactivated, when
its turn comes. Although reactivation
returns it to the loop where it was sleep-
ing before recall, the loop condition
(time slice = zero) has been changed,
so the program can escape from this
loop and reenter its old code at the next
instruction after the break.
Since the procedure for bringing a pro-
gram back from a break is somewhat in-
volved, requiring as it does the unnest-
ing of two different interrupts, a closer
look might be worthwile. First TSAR, at
line 179D, discovers that the program is
again enabled, so its time slice Ui loaded
into the interval timer. Then the stack
pointer for this program is brought in
from STAX. It will point to the location
just below that where the Y register was
stored. Registers Y, X, and A are loaded
from this stack, and RTI restores the flag
register, in which the Z flag is SET, and
returns control at line 17B5 or 17B7 of
the breakpoint routine. This is the stall-
ing loop where the program idled from
the break interrupt until its former time
slice expired and it was recalled by
TSAR.
Now, however, its time slice has been
adjusted from zero, and when this is dis-
covered the loop is abandoned cind con-
trol goes once more to TSAR's exit rou-
tine, this time at 17A8. The X and A
values from before the break are brought
in, and the second pass through RTI re-
stores P and PC, returning control to the
user program at the instruction follow-
ing the branch/break code. This entire
procedure is carried out with no effect
on the other programs operating under
TSAR, except that each runs a bit more
slowly when this program returns to ser-
vice and again requires a slice of the
MPU's time.
Caveat Computor
Because of significant differences
between operating under TSAR and
operating under the KIM monitor, a few
warnings are in order. Although most
have been mentioned before, they are
collected here for emphasis and elabor-
ation. Programs running simultaneously
under TSAR, including the monitor, must
not normally share RAM storage or use
common subroutines unless they are ful-
ly reentrant. This restricts user pro-
grams from calling the keypad and dis-
play routines if the monitor is enabled,
and monitor RAM locations, like the
pointer at OOFA,B must be scrupulously
avoided. However, it is possible to bring
up the TSAR system without an enabled
monitor, permitting user programs to
use the monitor utility routines. Simply
altering the monitor protect code and
then disabling the monitor is an in-
elegant but easy way to manage this. It
does, however, fill one place on the
queue with a dead monitor.
A better procedure is to set up all the
stacks, time slices, and pointers in ad-
vance, initiate the execution of a single
user program from the monitor (with
"GO"), and then use "ST" to leap up to
TSAR. Although this approach sacri-
fices interactive control of the system,
that may be prevented by giving up the
breakpoint routine and re-directing IRQ
to the monitor at 1C00. An external
device (switch?) that can deliver an IRQ
might now restore the monitor on-line.
Note that this procedure differs Jrom a
recall by TSAR, in that the registers of
the interrupted program are saved in
monitor RAM instead of the program
stack, meaning that the monitor has, for
the time being, replaced one of the user
programs on the queue. When the
monitor is no longer needed, "PC"
followed by "GO" will switch them back
again, putting the monitor out of and the
user program back into circulation.
A disadvantage of this procedure is
that, without additional control hard-
ware, the program which is replaced by
the monitor will be selected by chance,
and several attempts may be needed to
locate a suitable candidate, one you are
willing to have idle as long as the
monitor is in use. To minimize repeated
blind interrupts and restarts of the sys-
tem, disable all of the programs that you
wish to keep running the first time you
IRQ the system into the monitor. This
greatly increases the chance that, on the
18:40
MICRO — The 6502 Journal
November, 1979
next interrupt, a non-essential program
wiil be replaced by the monitor, and then
the disabled programs can be reenabled.
I prefer, instead, to retain continuous
monitor presence and have my user pro-
grams do their I/O through ports rather
than through the l^eypad and display
routines.
Because of the changes in timing in-
troduced, serial I/O drivers, such as the
cassette and serial teleprinter routines
in the ROM, cannot be expected to
operate properly under TSAR.
For more than six user programs,
references to STAX, TIMES, and INDEX
will need to be changed in TSAR, to re-
flect the re-organization of page zero
memory use.
One of the most bizarre malfunctions
that can occur under TSAR is to have
more than one copy of the monitor con-
currently active. Since the code is not
reentrant, the multiple copies share
RAM locations and interact oddly, pro-
ducing such symptoms as:
a. Keystroke double entry. This
may be nice for bbookkeepers,
but it makes it very difficult to
address location 0327 when
pressing the "3" key inserts two
nibbles of "3", while the " + '
key advances two cells at a time
b. Total or sporadic failure to res
pond to certain keystroke com
mands, as one copy of the
monitor receives the command
but, before it can finish ex-
ecuting it, the other copy garbles
up the message.
An intriguing challenge, at this point,
is to locate and disable the imposter—
the marauding mock monitor— before it
brings down the system altogether. My
record of two successes in five trys is
more impressive than It sounds.
The possibility of numerous heirarchy
violations exists under TSAFI because,
In the absence of protectable memory
regions (ROM doesn't count here), any
executing program Is considered the
equal of any other. This permits a lowly
user program, Intentionally or other-
wise, to plunder page twenty-three and
wound or altogether destroy beloved
TSAR. He may even manage to wrest
control of the system, gaining thereby a
sort of immortality, by preventing the
changing of INDEX or by disabling all
competition. The opportunities for such
exotic malfunctioning are vast, but they
are easy to avoid and the interest they
contribute far outweighs whatever minor
annoyance they might occasionally pro-
duce. In fact, they can be a source of
very interesting diagnostic oppor-
tunities. For instance, imagine trying to
reestablish control in a situation where
monitor monitors monitor.
RTI
As I mentioned earlier, neither the
design nor the operation of TSAR Is over-
ly complicated. In spite of the enormous
increase in capability that TSAR brings
to KIM, the system is really quite simple
to bring up and to operate. In fact, ex-
cept for some flickering of the display,
the monitor behaves as If it were in
charge, rather than operating under the
supervision of TSAR. Moreover, I have
found that any apparent malfunctioning
of TSAR could eventually be traced to
carelessness on my part— in running a
flawed program or in failing to initialize
a pointer-stack combination properly.
I assume that this system is easily
adapted for use on other 6502 com-
puters, and I would like to hear from
anyone who brings it up on an AIM, SYM,
or other 6502 machine, or who finds in-
teresting, useful, or entertaining appli-
cations for it. How about a memory map-
ped display routine providing current in-
formation regarding the system status,
like: number of currently enabled pro-
grams, disabled (I.e. available for use)
INDEX values, percentage of running
time alloted to each enabled program,
maximum stack depth attained by each
program (could head off disasters). Of
course, this program would be on the
queue and would be reporting on itself
as well as on the others. With all that va-
cant ROM space from 1A96 to 1BF9, I
wish I knew a way to hide TSAR up there,
out of danger from peasant programs
and proletarian programmers, but ready
to take command of a timesharing
system when summoned.
T.D.O.
TAPE DATA QUERY
PET-8K
SOL-IIA
TRS-80-LEVEL II
* FILE MANAGEMENT SYSTEM
—Utilizes Dual Audio Cas.sette Recorders
* INTERACTIVE QUERY LANGUAGE
—English-Like Commands
—Powerful Info Retrieval Capability
* COMPUTERIZED BUSINESS & PERSONAL RECORDS
—Customize Your Own File Structures
—Create & Maintain Data Files
—No Programming Experience Required
* IMPLEMENTED IN BASIC
T.D.Q. CASSETTE WITH MANUAL & REF. CARD $50.00
The Following Pre-Defined T.D.Q. File Structures
Are Available To Solve Your Data Processing Needs:
INVENTORY CONTROL $35.00
ACCOUNTS RECEIVABLE $35.00
ACCOUNTS PAYABLE $35.00
ORDER PROCESSING $35.00
CUSTOMER DIRECTORY $25.00
APPOINTMENT SCHEDULING $25.00
Each With Cassette And Manual
Send Self-Addressed Stamped Envelope For
Complete Software Catalogue.
Send Check Or Money-Order To:
H. GELLER COMPUTER SYSTEMS
DEPT. M, P.O. BOX 350
NEW YORK, NY 10040
(New York Residents Add Applicable Sales Tax)
NOW AVAILABLE
For SOL-IIA and PET-8K
GENEFLAL PACK 1 $11.00
(Checkbook Balancer, Tic Tac Toe, Metric Conversion)
GENEFLAL PACK 2 $19.00
(Space Patrol, Biorhythm, Battlestar, One-Armed Bandit)
FINANCIAL PACK 1
(Loans,, Depreciation, Investments)
$13.00
FINANCIAL PACK 2 $13.00
(Mortgage & Loan Amortization, Future Projections,
Risk Analysis)
STATISTICS PACK 1 $19.00
(Mean S: Deviation, Distribution, Linear Correlation &
Regression, Contingency Table Analysis)
GAME PACK 1 $20.00
(Basketball, Object Removal, Bowling, Darts, Gopher)
GAME PACK 2 - (children - educational)
(Arithmetic God, Addition Dice, Travel)
$13.00
For the KIM-1
PCROS - A Real-Time Operating System in the $50.00
IK KIM RAM
Includes: Assembly listing; Cassette with user's
manual; Schematic for relay control board
inc.
BOX 120
ALLAMUCHY, N.J. 07820
201-362-6574
HUDSON DIGITAL ELECTRONICS INC.
THE HDE MINI-DISK SYSTEM
VERSIONS
KIM
TIM
AIM 65 -4th Qtr. '79
SYM - 1 St Qtr. '80
SINGLE DRIVE
DUAL DRIVE
$ 795.00
$1195.00
Complete with all hardware.
Interconnecting cables, FODS,
text editor and user and instal-
lation manuals.
The HDE DM81 6-MDl Mini Disl< System is the per-
ipheral you have been waiting for. No longer bounded
by long and unreliable cassette saves and loads, your
computer becomes a sophisticated system for program
development or general purpose use. With the HDE
Mini-Disk you load and save programs in seconds, not
minutes or hours. And, since all transfers to and from
the Mini-Disk are verified for accuracy, the data will be
there when you need it.
The HDE DM816-MD1 Mini-Disk has been "systems"
engineered to provide a complete and integrated capa-
bility. Software and hardware have been built as a team
using the most reliable components available. The sys-
tems software includes the acclaimed and proven
HDE File Oriented Disk System and Text EDitor, requir-
ing only 8K for the operating software and overlay area.
Systems expanding programs available include the
two-pass HDE assembler, the Text Output Processing
System and Dynamic Debugging Tool. Hardware in-
cludes a Western Digital 1771 based controller in a
state-of-the-art 4V2 x 6V2" card size, Shugart SA 400 drive
and the Alpha power supply.
The storage media for the DM81 6-MD1 is the stan-
dard, soft sectored 5%" mini diskette readily available
at most computer stores, and HDE has designed the
system so that the diskettes rotate only during disk
transactions, favorably extending media life. A disk
formatter routine included with the system, formats the
diskettes, verifies media integrity by a comprehensive
R/W test and checks drive RPM. Additional utilities
provide ascending or descending alpha numeric sort.
disk packing, text output formatting, file renaming,
file addressing and other capabilities.
HDE PRODUCTS. BUILT TO BE USED WITH CONFIDENCE.
AVAILABLE DIRECT OR FROM THESE FINE DEALERS:
JOHNSON COMPUTER
Box 523
Medina. Ohio 44256
216-725-4560
PLAINSMAN MICROSYSTEMS ARESCO
Box 1712 P.O Box 43
Auburn. Ala. 36830 Audubon. Pa 19407
800-633-8724 215-631-9052
LONG ISLAND
COMPUTER GENERAL STORE
103 Atlantic Avenue
Lynbrook, NY. 1 1563
516-887-1500
LONE STAR ELECTRONICS
Box 488
Manctiaca, Texas 78652
612-282-3570
Interfacing the CI-812 to the KIM
If you want to add I/O capabilities to your KIM, then
consider the CI-812 I/O board and its abilities.
Jim Dennis
2305 Pinecrest
Nacogdoches, TX 75962
^
The Percom CI-812 I/O board contains
a full-duplex data terminal interface
(RS-232) and a cassette interface that
can load and dump data at rates up to
2400 baud. The CI-812 comes with 8080
software and is useless to 6502 owners,
as is. I have interfaced a CI-812 to a
KIMSI 6502 to S-100 motherboard, and I
have written software that loads and
dumps to the CI-812 from a KIM.
There are several reasons why I
wanted to add this board to my I/O
library. First, under the right conditions,
data transfer can take place very quickly
compared to the standard 10 cps of the
KIM, and the rates are easily controlled
in the software.
Second, if the user is interested in
building a terminal to communicate with
a big computer or with another small
computer via a modem, all that is need-
ed additionally is a modem ($125 for a
Pennywhislle), a TVT-6 ($35), and a video
monitor ($150), or a converted black and
white TV, to turn the KIM into a full-
fledged intelligent terminal.
Third, data received from magnetic
tape is self-clocked with a signal ex-
tracted from the data. Speed variations
in the tape drive and baud rate changes
are thereby eliminated as sources of er-
ror.
The KIMSI generates S-100 bus
signals and the decode enable from the
signals on the expansion connector of
the KIM. S-100 signals of the bus master
type used by the CI-812, in addition to
the tri-stated address lines and the DO
and Dl lines, include PWR, PDBIN, SINP,
and SOUT. PWR is an active low signal
denoting stable data on the DO lines,
PDBIN is an active high signal that
enables the Dl lines, while SINP and
SOUT are active high signals that in-
dicate the addressing of an I/O device.
The CI-812 does not directly interface
with the KIMSI because of timing pro-
blems associated with SINP, SOUT, and
the DO buffer enable. Also, the 2 MHz
clock pulse required by the CI-812 is not
generated by the KIMSI. The procedure
for overcoming these problems is:
1. Jumper the 1 MHz eiiable from
finger 62 of the KIMSI to finger
49 of the KIMSI.
2. Bypass the first divide-by-two
stage of the clock by bending up
pin 5 109 of the CI-812 and jump-
ering pin 5 IC12 to pin 8 1C3.
3. Create a new signal, which I call
SNOUT, that goes high whenever
an I/O device is addressed. SNOUT
is available at pin 10 IC9 of the
KIMSI. Jumper it to finger 96 of the
KIMSI.
4. Bypass the OR-INVERT of SINP
and SOUT by the CI-812 by jump-
ering finger 96 of the KIMSI to pin
IC20 of the CI-812 and by bending
up pin 4 IC2of the CI-812.
5. Permanently enable the DO buffers
by jumpering pin 12 IC14 of the
CI-812.
This completes the hardware revision
of the KIMSI and the CI-812. The CI-812
outputs bi-phase (Manchester! code con-
sisting of bursts of 2400 Hz square
waves for a logic one and 1200 Hz
square waves for a logic zero. Impress-
ing unfiltered square waves on magnetic
tape and then reading them involves a
double differentiation process that can
cause errors at high baud rates. For this
reason, computer grade tape and baud
rates of not more than 300 are recom-
mended. Three hundred baud is known
as the Kansas City standard.
The program shown is a checksum
loader-dump routine which I have written
for the KIM-PERCOM-KIMSI combina-
tion. The KIMSI uses memory mapping to
address I/O devices, reserving address
range FOXX for I/O devices.
My PERCOM board is addressed at
FOEX; X = 1, 2. The program follows the
format of the KIM cassette loader and
dump, loading block headers and EOT's
in Hex and all else in ASCII. No SYN
characters are necessary. When a pro-
gram has been dumped, the monitor
takes over at address 0000. If a program
has loaded correctly, the address dis-
play will light at 0000 also. If an illegal
hex character has been encountered,
meaning that the tape has been read in-
correctly, the display will light at the
starting address of the loader.
For example, if two ASCII characters
are decoded to a J6, which is supposed
to be a hex byte, then the tape has been
read incorrectly. If a checksum error oc-
curs, then the display will light with the
calculated checksum high or low byte
repeated twice in the address display.
The ASCII — hex checksum load and
dump routine for the KIM uses the
following KIM monitor subroutines: VEB,
INTVEB, CHKT, INCVEB and PACKT.
The CI-812 is addressed at F0E1 and
F0E2 in the program listing. The ASCII
— hex dump starts at 0000 and loads at
0070. To change to another location,
modify locations denoted by "*" to
reference the new page.
November, 1979
MICRO — The 6502 Journal
18:43
008C FO
02
BEO GETBYT
YES, PICK UP NEXT 2 CHARAC.
008E DO
F7
BNE RDY?
NO, LOOK AGAIN
SUBROm"INE
FUNCTION
0090 20
23
01"
' GETBYT
JSR ASCIIHEX
GET NEXT 2 CHAR. AND CONVERT
0093 CD
F9
17
CMP ID
IS IT THE RIGHT BLOCK?
OUTCHR
DUMPS ASCII CHR OK TAPE
0096 FO
02
BEQ GO
YES, GET FIRST CHARACTER
OUTBYTC
DUMPS IHEX BYTE AS 2 ASCII CHR AND
0098 DO
F6
BNE GETBYT
NO, KEEP LOOKING FOR ID
INCREMENTS CHKSUM
009A 29
23
01*
GO
JSR ASCIIHEX
GET BYTE AND CONVERT TO HEX
OUTBYT
SAME AS ABOVE
3UT DOES NOT INC CHKSUM
009D 20
4C
19
JSR CHKSUM
INC CHECKSUM
LDASCII
LOADS 1 ASCII
CHR
OOAO 8D
ED
17
STA VEB + 1
STORE CHKSUM LOW
HEXTOAS
CONVERTS 1/2 HEX BYTE TO ASCII |
00A3 20
23 01*
JSR ASCIIHEX
00A6 20
4C
19
JSR CHKSUM
00A9 8D
EE
17
STA VEB + 2
STORE CHKSUM HIGH
OOAC A2
02
G02
LDXIM 02
LDX CHAR. COUNTER
OOAE 20
32
01*
GOl
JSR LDASCII
GET ASCII CHAR.
0000 A9 AD
LDAIM AD
INITIALIZE VEB AS DUMP
OOBl C9
2F
CMPIM EOT
IS IT EOT?
0002 8D EC
17
STA VEB
00B3 FO
17
BEQ CONT
YES, FINISH
0005 20 32
19
JSR INTVEB
INITIALIZE VEB
00B5 20
00
lA
JSR PACKT
NO, PACK ASCII AS HEX
0008 A9 2A
LDAIM ASCII
'*' ASCII SYNC
00B8 FO
03
BEQ VALASC
BEQ VALID ASCII CHAR.
OOOA 20 56
00*
JSR OUTCHR
OUTPUT BLOCK HEADER
OOBA 4C 4F
IC
JMP START
ERROR EXIT
OOOD AD F9
17
LDA ID
OOBD CA
VALASC
DEX
DEC. CHAR. COUNTER
0010 20 03
01*
JSR OUTBYT
OUTPUT ID WITHOUT CHKS
OOBE DO
EE
BNE GOl
GET 2ND CHAR.
0013 AD F5
17
LDA SAL
STARTING ADDRESS LOW
00 CO 20
4C
19
JSR CHKSUM
INC CHKSUM
0016 20 00
01*
JSR OUTBYTC
OUTPUT WITH CHKSUM
00C3 4C
EC
17
JMP VEB
MOVE SA TO VEB
0019 AD F6
17
LDA SAH
STARTING ADDRESS HIGH
00C6 20
EA
19
JSR INCVEB
INC. CURRENT ADD.
00 IC 20 00
01*
JSR OUTBYTC
00C9 4C
AC CO*
JMP G02
LOOP BAK FOR MORE CHAR.
OOIF AD ED
17
STRT LDA VEB + 1
GET CURRENT ADD. LOW
OOCC 20 23 01*
CONT
JSR ASCIIHEX
GET CHKSUM
0022 CD F7
17
CMP EAL
CMP WITH ENDING ADD. L
OOCF FO
03
BEQ CKOK?
IT IT VALID HEX?
0025 AD EE
17
LDA VEB + 2
GET CURRENT ADD. HIGH
OODl 4C
2B
19
JMP ERROREX
NO, EXIT
0028 ED F8
17
SBC EAH
SBC ENDING ADD. HIGH
00D4 CD
E7
17
CKOK?
CMP CHKSUML
YES, COMPARE WITH CALC. CHKS
002B 90 lA
BCC DUMP2
DO THEY AGREE?
00 D7 FO
03
BEQ OK
CHKSUM LOW AGREES
002D A9 2F
LDA ASCII'/
YES, LDA ASCII SLASH
00D9 4C
2B
19
BADNEW
:JMP ERROREX
CHKSUM LOW DOES NOT AGREE
002 F 20 56
00'
JSR OUTCHR
OUTPUT EOT
00 DC 20
23 01*
OK
JSR ASCIIHEX
GET CHKSUM HIGH
0032 AD E7
17
LDA CHKSUML
GET CHKSUM LOW
OODF CD
E8
17
CMP CHKSUMH
COMPARE WITH CALC. CHKSUMH
0035 20 03
01*
JSR OUTBYT
OUTPUT
00E2 DO
F5
BNE BADNEWS
CHKSUM HIGH DOES NOT AGREE
0038 AD E8
17
LDA CHKSUm
GET CHKSUM HIGH
00E4 A9
00
LDAIM 00
003B 20 03
01*
JSR OUTBYT
OUTPUT
00E6 4C
28
19
JMP NORMEX
CHKSUM AGREES
00 3E A9 00
LDA 00
0100 20
4C
19
JSR CHKSUM
CALC. CHKSUM
0040 85 FA
STAZ POINTL
0103 A8
TAY
SAVE BYTE
0042 85 FB
STAZ POINTH
0104 4A
LSRA
0044 4C 4F
iC
JMP START
ALL OK, RETURN TO MON
0105 4A
LSRA
0047 20 EC
17
DUMP2 JSR VEB
PICK UP NEXT BYTE
0106 4A
LSRA
004A 20 00
01*
JSR OUTBYTC
OUTPUT
0107 4A
LSRA
SHIFT OUT LSB
004D 20 EA
19
JSR INCVEB
INC CURRENT ADDRESS
0108 20
13 01
*
JSR HEXTOAS
CONVERT TO ASCII
0050 4C IF 00^
4C STRT
OlOB 98
TYA
RESTORE BYTE
0053 EA
NOP
OlOC 20
13 01
*
JSR HEXTOAS
OUTPUT MSB AS ASCII
0054 EA
NOP
OlOF 98
TYA
RESTORE BYTE
0055 EA
NOP
0110 60
RTS
0056 48
PHA
SAVE BYTE
0111 EA
NOP
0057 A9 03
LDAIM 03
LDA SELECT CODE
0112 EA
NOP
0059 8D EC
FO
STA CAS-SEL
SELECT CASSETTE MODE
0113 29
OF
ANDIM OF
MASK MSB
005C AD El
FO
LDA UARTOUT
READ UART TO CLEAR
0115 C9
OA
CMPIM OA
005F AD EO
FO
CLEAR LDA STATUS
READ STATUS
0117 18
CLC
0062 29 80
ANDIM 80
MASK STATUS BIT
0118 30
02
BPL CONV
0064 FO F9
BEQ CLEAR
LOOP IF STILL TRANSMIT
OllA 69
07
ADCIM 07
0066 68
PHA
RESTORE BYTE
one 69
30
CONV
ADCIM 30
CONVERT TO ASCII
0067 80 El
FO
STA CASOUT
OUTPUT TO UART
OllE 20
56 00*
JSR OUTCHR
OUTPUT AS ASCII
006A 60
RTS
0121 60
RTS
006B EA
NOP
0122 EA
NOP
006C EA
NOP
0123 20
32
o:i*
JSR LDASCII
READS UART
006D EA
NOP
0126 20
00
lA
JSR PAaT
PACKS 2 ASCII CHAR.
006E EA
NOP
0129 20
32
01*
JSR LDASCII
AS 1 HEX BYTE
006F EA
NOP
LOADER BEGINS HERE
012C 20
00
lA
JSR PACKT
0070 A9 8D
LDAIM 8D
SET UP VEB AS LOADER
012F 60
RTS
0072 80 EC
17
STA VEB
0130 EA
NOP
0075 20 32
19
JSR INTVEB
INITIALIZE VEB AS LOADER
U131 EA
NOP
b078 AS 4C
LDAIM 4C
0132 A9
01
LDAIM 01
CODE FOR CASSETTE LOAD
007A 8D EF
17
STA VEB +3
0134 8D EO
FO
STA UART
OUTPUT TO UART
007D A9 C6
*
LDAIM C6
0137 AD
El
FO
LOOP
LDA UARTOUT
CLEAR UART
007F 8D FO
17
STA VEB + 4
013A AD
EO
FCi
LDA FLAG
READ STATUS
0082 A9 00
*
LDAIM 00
LOADER RETURNS FROM VEB
013D 29
40
ANDIM 40
MASK STATUS BIT
0084 8D Fl
17
STA VEB + 5
WITH JMP TO LOC. 00C6
013F FO
F9
BEQ LOOP
IF NOT READY, WAIT
0087 20 32
01*
RDY? JSR LDASCII
LOOK FOR BLOCK HEADER
0141 AD El
FC
LDA DATA
LOAD ASCII CHAR.
008A C9 2A
CMPIM '*'
IS IT A SYNC?
0144 60
RTS
RETURN
18:44
MICRO -
- The 6502 Journal
November, 1979
^^
AMPERSORT
Alan G. Hill
12092 Oeerhorn Drive
Cincinnati, OH 45240
I apologize to MICRO readers for the
errors in the listing of AMPERSORT
published in MICRO 14:39. The problem
was a result of including the first five
pages of an earlier version w/ilh the last
two pages of a later version to which
lines 3940 thru 3946 were added. This
caused, as many readers discovered^ the
object address of some of the preceding
code to be incorrect. Attached is a
listing of the correct object code.
Anyone wishing to receive an improved
version on cassette may do so by sen-
ding $5.00 to me at the above address.
Several people have asked if AMPER-
SORT can be used with Applesoft in
RAM rather than ROM. With the follow-
ing changes it can;
Routine
ROM Addr. RAM Addr.
FRMNUM $DD67 $156A
GETADR ?E752 $1F49
GETBYT $E6F8 $1EEF
SNER $DEC9 $16CC
The Applesoft RAM BASIC program
must also Include the following
statements that must be executed prior
to the first '&SRT' command:
POKE 2142,244: POKE 2143,3
The specific changes to AMPERSORT
for Applesoft RAM are:
Address
ROM Ver. RAM Ver.
$5269
67
6A
$526A
DD
15
$526C
52
49
$526 D
E7
IF
$527A
67
6A
$5278
DD
15
$527D
52
49
$527E
E7
1F
$52A9
C9
CC
$52AA
DE
16
$5284
F8
EF
$5285
E6
IE
$52C0
F8
EF
$52C1
E6
IE
Microbes
Note on Charles Husband's
Speech Processor for the PET
MICRO 16:41
Readers interested in obtaining addi-
tional information about the Data—Boy
Speech Processor should contact Jim
Anderson at:
MIMIC Electronics
Box 921
Acton, MA 01720
*5200
.5589
53C0-
82
55
30
OC Bl
D8 Dl DC
53 C 3-
BO
14
20
CI 54
4C 05 54
5200-
48
20
E6
54
68
A2
00
DD
53D0-
Bl
D8
Dl
DC 90
2F FO 19
5208-
2C
55
DO
46
20
Bl
00
E8
53D8-
20
CI
54
4C 05
54 DO 25
5210-
EO
05
DO
F3
A2
00
FO
03
53E0-
C8
C4
EF
FO 06
C4 FO FO
5218-
20
Bl
00
C9
2C
FO
OA
9D
53E3-
16
90
OF
C4 FO
90 E9 FO
5220-
72
55
E8
EO
10
DO
Fl
FO
53F0-
OE
C8
C4
EF FO
09 C4 FO
5228-
29
CA
BD
72
55
C9
24
FO
53F8-
FO
DE
98
D5 E7
DO CO E8
5230-
24
C9
25
DO
15
A2
01
A9
5400-
EC
88
55
DO B8
E6 ED DO
5238-
80
IB
72
55
9D
72
55
CA
5408-
02
E6
EE
A5 EB
C5 EO AS
5240-
10
F5
A9
02
85
EC
A?
01
5410-
EE
E5
El
90 14
E6 DE 00
5248-
DO
19
M
05
85
EC
A9
02
5413-
02
E6
DF
A5 DE
C5 D4 A5
5250-
DO
11
4C
AS
52
A9
80
OD
5420-
DF
E5
D5
90 07
20 09 55
5258-
73
55
8D
73
55
A9
03
85
5428-
60
4C
8E
53 4C
59 53 18
5260-
EC
M
OO
85
Fl
20
Bl
00
5430-
6(\
BO
03
4C 6D
54 AO 01
52A3-
20
67
DD
20
52
E7
A5
50
5438-
Bl
D6
Dl
DA 88
Bl D6 Fl
5270-
85
DE
A5
51
85
DF
20
Bl
5440-
DA
90
22
Bl D6
51 DA 30
5278-
00
20
67
DD
20
52
E7
AS
5448-
BC
C8
Bl
DA 48
88 Bl DA
5280-
50
85
D4
18
69
01
85
EO
5450-
48
Bl
D6
91 DA
C8 Bl D6
5288-
A5
51
85
DS
69
00
85
El
5458-
91
DA
88
68 91
D6 C8 68
5290-
A5
Fl
DO
59
FO
15
A2
00
5460-
91
D6
4C
05 54
Bl B6 51
5298-
6D
31
55
09
80
20
ED
FD
5468-
DA
30
BE
10 98
AO 00 Bl
52A0-
EB
EO
17
DO
F3
20
09
55
5470-
D6
ni
DA
90 OE
FO 02 BO
52A8-
4C
C9
DE
AO
00
8C
89
55
5478-
ID
C8
CO
05 DO
Fl FO 3E
52B0-
20
Bl
OO
20
F8
E6
CA
AC
54 80-
AO
01
Bl
D6 31
DA 11 DA
52B3-
89
55
96
E2
20
Bl
00
20
5438-
30
20
88
Bl DA
DO 2F C8
52C0-
F8
E6
AC
39
55
96
E7
20
5490-
Bl
D6
10
16 30
28 AO 01
52C8-
Bl
OO
90
D9
C9
44
FO
04
5498-
Bl
D6
31
DA 11
06 30 IE
52D0-
A9
FF
30
02
A9
00
99
82
54A0-
88
Bl
D6
DO 05
C8 Bl DA
52D8-
55
C8
8C
39
55
20
Bl
00
54A8-
10
H
AO
04 Bl
D6 48 88
52E0-
C9
29
FO
06
C9
2C
FO
C8
54B0-
10
FA
C8
Bl DA
91 D6 68
S2E8-
DO
BB
8C
88
55
20
Bl
00
54B8-
91
DA
CO
04 DO
F4 4C 05
52F0-
DO
B3
AO
00
Bl
6B
CD
72
54C0-
54
AO
00
Bl D6
48 C8 AS
52FS-
55
no
08
C8
Bl
6B
CD
73
54C3-
D8
91
DA
C8 A5
D9 91 DA
53O0-
55
FO
2B
18
AO
02
Bl
6B
54D0-
A5
DD
91
D6 85
D9 88 AS
5308-
65
6B
48
C8
Bl
6B
65
6C
54 D 3-
DC
91
D6
85 D8
88 Bl DA
5310-
85
6C
68
85
6B
C5
6D
AS
54E0-
91
D6
68
91 DA
60 A2 00
5318-
6C
E5
6E
BO
03
4C
.r2
52
54E8-
B5
DO
9D
48 55
E8 EO 22
5320-
A2
02
BB
72
55
9D
3B
55
54ro-
DO
F6
A5
6B 8D
70 55 A5
5328-
CA
10
F7
4C
96
52
18
AS
54r8-
6C
8D
71
55 A2
00 BS 50
5330-
6B
69
07
85
52
A5
iC
69
5500-
9D
6A
55
E8 EO
06 DO F6
5338-
00
85
53
A5
DE
85
50
AS
5508-
60
A2
00
BD 48
55 95 DO
5340-
DF
85
51
A5
EC
85
154
M
55 .to-
E8
EO
22
DO F6
AD 70 55
5348-
00
85
55
20
63
FB
A5
SO
ss 18-
85
6B
AD
7\ 55
85 6C A2
5350-
85
D£
A5
51
85
B7
4C
66
5520"
00
ED
6A
55 95
50 E8 EO
5358-
53
18
A5
D6
65
EC
135
D6
5528-
06
DO
F6
60 53
52 54 23
5360-
A5
Bl
07
D6
69
85
OO
D8
85
C8
D7
Bl
AO
01
5530-
5538-
28
4C
8D
45
56
20
41 52
20 20
49 41 42
5363-
1)6
85
20 20 4E
5370-
D9
18
A5
06
65
EC
85
DA
5540-
4F
54
20
46 4F
55 4E 44
5378-
A5
D7
69
OO
85
DB
:l8
AS
5548-
00
00
00
00 00
00 00 00
5380-
DE
69
01
85
ED
AS
)JF
69
5550-
00
OO
00
00 00
00 00 00
5388-
00
85
EE
4C
9B
53
:i8
AS
5558-
00
OO
00
OO 00
00 00 00
5390-
DA
65
EC
85
DA
AS
»B
69
5560-
00
OO
00
00 00
00 00 00
5398-
00
85
DB
AO
01
Bl
»A
85
5563-
00
00
00
00 00
00 00 00
53A0-
DC
C8
Bl
DA
85
DD
AS
Fl
5570-
00
00
00
00 00
00 00 00
53A8-
FO
03
4C
2F
54
AO
<I0
Bl
5578-
00
00
00
00 00
00 00 00
53B0-
D6
FO
52
85
EF
Bl
»A
FO
5580-
00
00
00
00 00
00 00 00
53B8-
4C
85
FO
A2
00
B4
E2
BO
5588-
00
OO
^
i^3(dQ(£)i
xv;«-.^ -- ;t ,j^sj v-v;^sj^vl ^^~tx.'^:><xxxx.:i<.Z'<x:
Data Acquisition Modules
]^C""*"'n
•ACCILdUTIOH
• HUUIOlTT
*UMT LCWL
•FLUID LfVtL
3 no
'-' ^ ) TBa-§0 MG
TRS-aO )NT(Anct
oisnjtT yoouLC
The world we live in is full of variables we want to
measure. These include weight, temperature, pressure,
humidity, speed and fluid level. These variables are
continuous and their values may be represented by a
voltage. This voltage is the analog of the physical varia-
ble. A device which converts a physical, mechanical or
chemical quantity to a voltage is called a sensor.
Computers do not understand voltages: They under-
stand bits. Bits are digital signals. A device which con-
verts voltages to bits is an analog-to-digital converter.
Our AIM1 6 (Analog Input Module) is a 1 6 input analog-
to-digital converter.
The goal of Connecticut microcomputer in designing
the DAM SYSTEMS is to produce easy to use, low cost
data acquisition modules for small computers. As the
line grows we will add control modules to the system.
These acquisition and control modules will include
digital input sensing (e.g. switches), analog input sens-
ing (e.g. temperature, humidity), digital output control
(e.g. lamps, motors, alarms), and analog output control
(e.g. X-Y plotters, or oscilloscopes).
.XXX^Ol i-i mfH.^it «>tM%f1-f n.J*Vt Vf Vf1.f 3JtVt ^J
S^
Analog Input Module
The AIM 16 is a 16 channel analog to digital converter
designed to work with most microcomputers. The
AIM16 is connected to the host computer through the
computer's 8 bit input port and 8 bit output port, or
through one of the DAM SYSTEMS special interfaces.
The input voltage range is to 5.12 volts. The input
voltage is converted to a count between and 255 (00
and FF hex). Resolution is 20 millivolts per count. Ac-
curacy is 0.5% ± 1 bit. Conversion time is less than 100
microseconds per channel. All 16 channels can be
scanned in less than 1.5 milliseconds.
Power requirements are 12 volts DC at 60 ma.
The F'OWl is the power module for the AIM16. One
P0W1 supplies enough power for one AIM 16, one
MANM0D1, sixteen sensors, one XPANDR1 and one
computer interface. The P0W1 comes in an American
version (POWIa) for 110 VAC and in a European ver-
sion (POWIe) for 230 VAC.
AIM16.
POWIa
POWIe,
$179.00
$ 14.95
$ 24.95
; >< Vr Ve >g-5< !.t5-!3.t«.>t.At>Il*M vgMvt«v evj%fvr« vtJ-!i-!Ti/
,x. >.:v;%<^sj-v- i.:v<xi..; ' i-;^x -^'W5-t^<v; :>^ vl :>j x. vt. >g-5g-?g
Connectors
^
^'^
The AIM 16 requires connections to its input port
(analog inputs) and its output port (computer inter-
face). The ICON (Input CONnector) is a 20 pin, solder
eyelet, edge connector for connecting inputs to each of
the AIM1 6's 1 6 channels. The OCON (Output CONnec-
tor) is a 20 pin, solder eyelet edge connector for con-
necting the computer's input and output ports to the
AIM16.
The MANM0D1 (MANifold MODule) replaces the
ICON. It has screw terminals and barrier strips for all 1 6
inputs for connecting pots, joysticks, voltage sources,
etc.
CABLE A24 (24 inch interconnect cable has an inter-
face connector on one end and an OCON equivalent on
the other. This cable provides connections between the
DAM SYSTEMS computer interfaces and the AIM16 or
XPANDR1 and between the XPANDR1 and up to eight
AIM16S.
ICON
OCON
MANM0D1 .
CABLE A24.
$ 9.95
$ 9.95
$59.95
$19.95
. X XXX >^ !-!i-!x^xvrvt.>gvt^x><.3-t><vgvr-sjv;ve^j'%<
J
->.rT^^.^7w-'VCW---V^S.?S.!'WS^ W -^ %J- S^^-TT-T-.^ ^ s.r 1-! Vf V- ;
XPANDR1
The XPANDR1 allows up to eight AIM 16 modules to be
connected to a computer at one time. The XPANDR1 is
connected to the computer in place of the AIM16. Up to
eight AIM1 6 modules are then connected to each of the
eight ports provided using a CABLE A24 for each
module. Power for the XPANDR1 is derived from the
AIM16 connected to the first port.
XPANDR1 . . . $59.95
■>.--!-r->.r->^'^'.>-T.<- -^^.; vg v^■^.^-^.^■^-^■v^■v.^->^■>.^-^■>^^.^■^>f -x ■ixr ■^■^•>^
>1 !-! S.r -g-SJ ■!^-i^ ^ - i^X^ - ^ - i~!X^,< : ><:
■^ ^■i^ ^■^.•^^
TEMPSENS
This module provides two temperature probes for use
by the AIM16. This module should be used with the
MANM0D1 for ease of hookup. The MANM0D1 will
support up to 16 probes (eight TEMPSENS modules).
Resolution for each probe is 1°F,
TEMPSENS2P1 (-10°F to 120°F)
$49.95 }
^■wwsj-sys.--,^----^^ ^ ^•>^-^->^->^-^ w w.^ ..^--"^ v.r !.<: s^ s^ w"l
Computer Interfaces
and Sets
For your convenience the AIM16 comes as part of a
number of sets. The minimum configuration for a usable
system Is the AIM16 Starter Set 1. This set includes
one AIIVI1 6, one P0W1 , one ICON and one OCON. The
AIM16 Starter Set 2 includes a IVIANM0D1 in place of
the ICON. Both of these sets require that you have a
hardware knowledge of your computer and of computer
interfacing.
For simple plug compatible systems we also offer
computer interfaces and sets for several home com-
puters.
The PETMOD plugs into the back of the Commodore
PET computer and provides two PET IEEE ports, one
user port and one DAM SYSTEMS port. The PETMOD Is
connected to the AIM1 6 or XPANDR1 with CABLE A24.
The PETSET1 includes one PETMOD, one CABLE A24,
one AIM16, one P0W1 and one MANM0D1. To read
and display a single AIM16 channel (N) using the
PETSET1 the BASIC statements
PDKE5942i,N:PQKE59426f 255 :X=PtEK( 59471 ) •.PRINT" CHANNEL "(t"="X
are all that is needed.
The KIMMOD plugs into the COMMODORE KIM ap-
plications connector and provides one application con-
nector and one DAM SYSTEM'S port. The KIMMOD is
connected to the AIM 16 or XPANDR1 with CABLE A24.
Assembly and machine language programs for reading
and displaying data are included. The KIMSET1 in-
cludes one KIMMOD, one CABLE A24, one AIM 1 6, one
P0W1 and one MANMOD 1.
All sets come in American and European versions.
AIM1 6 Starter Set 1a (110 VAC) ... $189.00
AIM 1 6 Starter Set 1e (230 VAC)... $199.00
AIM1 6 Starter Set 2a (110 VAC) ... $259.00
AIM 1 6 Starter Set 2e( 230 VAC) ... $269.00
PETMOD ... $ 49.95
KIMMOD ... $ 39.95
PETSETIa... $295.00
PETSETIe... $305.00
KIMSETIa... $285.00
KIMSETIe... $295.00
fix 5-t><->-Lj-i ^i<3<.n.yfi< KsfM^jvtMVfM ^^■v^vgvt ve a-ix.j
Our Guarantee of Satisfaction
Our customers are our most Important asset. We want
you to be pleased with whatever you purchase from us.
We strive to offer top quality products at reasonable
prices. We believe you should see an itefn before you
spend your hard earned cash for It.
Ask for a demonstration at your local computer store
so you can be sure our products perform as you want
them to perform. Your dealer is a valued source of infor-
mation and advice.
If you cannot see our products in advance, and order
direct from us, we offer a money back guarantee. If our
products don't perform as you expect, return the mer-
chandise to us within 30 days, in its original condition,
and Vi^e will refund the purchase price.
Ou r standard warranty for all our products Is 90 days.
4<^-riclt^*.^3<^vtutJ;!>;v- !_■---■!-;%<■ -^.j-tj-; -ye ve ;-tV!. ^J':;
|io-=vi^i-^>-=!-t>-:«'^vfVJ'^v:s-?^'-:vg ■!-i-sg-;
;^^^ !g-sg-
.><X>^XJ
- --J ^ s^ s«- w s.; ^vf ■i-;^..^■^.< ^:x-s<!->«! v.^ w v s .f s^ 'i
^X-T>.:X"><-»<Vf1^irfVfVg1>J1>t K ■«■■!-? vr-^f-vt-ww s.' VJ i.^ w s^ w
f^'>^->^-^^'i^.^ ^■.^WWSJV^SJI.^S^ H-»W--.f..-SJ S.! WW vw w
Coming Soon
TEMPSENS-2P with other temperature ranges. Inter-
faces for TRS-80, APPLE, A1M65. Light sensors. Out-
put modules. Contact us for price and availability.
jj-.^^^ H X X y XX. xx>f>L^vivf tt-H.vtvfvevfV; sj - i^ J i
^X-^^i^-m^r.^^-^lJV'^ M W.J .,.,; vr^v . w r-g-
Dealers
< '
Give your potential customers a reason for buying your
computers. We offer excellent discounts to legitimate
dealers. Contact us for our dealer pack.
Order Form
CONNECTICUT microCOMPUTER , Inc.
150 POCONO ROAD
BROOKFIELD, CONNECTICUT 06804
TEL: (203) 775-9659 TWX: 710-456-0052
QUANTITY
DESCRIPTION
PRICE
TOTAL
SUBTOTAL
Handlirigand shipping — add per order
S3.00
Foreign orders add 10% for AIR postage
Connecticut residents add 7% sales tax
TOTAL ENCLOSED
NAME
rnUPAMY
AnnRFR.<!
CITY
STATF
7IP
VISA O M/C O
.Fi^pirj^ttonriatp
Carfl niimhpr
.^I^^^^SiS^S^^^S^^^^^^S^^^SSI^S^S^Z^^^Z^^
: wxx ^SD
r ^r.^^^^x - .^^ -~^-~i ^ >^ ^ ^.^XXXX.X^-qjx . P'.^-s-'S ::
PET Printer Adapter
The CmC ADA 1200 drives an RS-232 printer from the
PET IEEE-488 bus. Now, the PET owner can obtain
hard copy listings and can type letters, manuscripts,
mailing labels, tables of data, pictures, invoices,
graphs, checks, needlepoint patterns, etc., using
RS-232 standard printer or terminal.
A cassette tape is included with software for plots,
formatting tables and screen dumps. The ADA1200
sells for $169.00 and includes case, power supply and
cable.
Order direct or contact your local computer store.
VISA AND M/C ACCEPT€D — SEND ACCOUNT NUMBER, EXPIRATION DATE AND SIGN ORDER.
ADD 13 PER ORDER TOR SHIPPING 1 HANDLING — FOREIGN ORDERS ADD 10% FOR AIR POSTAGE
CONNECTICUT microCOMPUTER, Inc.
150 POCONO ROAD
BROOKFIBLD, CONNECTICUT 08804
TEL: (203) 775-9659 TWX: 710-456-0052
^vf-vt VI V! vti<jj%ji^igi<«ve»jvevt>t.>t.»<.vt.^ i*9<.i<xjA
softside
soitivare
305 Riv«rlLi(Je Drive New York W V^Tnn^T
fit
program.
1CJ-RAPHICS PAC 2 Quadruple your PET's graphic resolution. Why be
New Version stuck with the PET's Cumbersome 25 x 40 1000 point
display. With Graphics Pac you can directly control
(set and cleir) 4000 points on screen. It's great for graphing, plotting, and gaining. Graphics
Pac allows you to plot in any combination of two modes: 4 Quadrant graphing with (0.0) center
screen, and Standard graphing with (0,0) plotted in the upper left hand corner. Complete docu-
mentation shows how you can merge this useful routine with any of your own programs wjth-
out retyping either one! All this on a high quality Microsette for only $9.95.
2 /assembler 2001 A full featured assembler for your PET microcompu-
ter that follows the standard set of 6502 mnemonics.
,.,-.. , _^^ „ Now you can take full advantage of the computing
abilities of your PET. Store and load via tape, run through the SYS or USR functions. List aTid
edit too with this powerful assembler. No other commercial PETassembler gives you all these
features pk s the ability to look at the PETS secret Basic ROMs ail in one program. This valu-
able program is offered at $15.95
3B!:KE An ejccitjng new sinjLiJatJon that puts you in
charge of a bicycle manufacturing empire. Juggle
inflation, breahdowns, seasonal sales variations,
inventory ■A-orhers. prices machines, and ad campaigns to keep your enterprise in the
black. Bjkejs dangerously addjctii^e Once you start a game you wUl not wan: to stop. To
allow you to take short resi breaks. Bike lets you store the data from your game on a tape
so you can continue where you left off next time you wish to play. Worth a million in fun
we'll offer :3IKE at S9 95.
4P1.NBALL Dynamic usage of the PET's graphics features
when combined with the fun of the number 1 arcade
game equals an acrjon packed video spectacie for
your computer Bumpers, chutes, flippers, free balls, gales, a jackpot, and a little luck
guarantee i great game for all. $9 95
Authors: Our royalties are unbeatable
./T
-^r^rCr^rCrCr MUSICAL MADDNESS -iV^VTVtHWr
add an exciting new dimension to your PET compLiter
with Soandware's soandsational music box
and sonicsoand software from Softside Si. Soundware
SOUND
t^ THE SOUNDWORKS ^
The Sourdivare music box for your PET
comes complete with controllable volume,
an earphone jack, a demo tape with two
programs, an instruction book, and a one
year warranty, this sturdy unit is enclosed
in an attractive plastic case. Notes tell
how to program your oivn sound effects.
All this during our musicaJ madness for
just 29.95
WORD FUN: Speller: fun ways to practice
spelling ■■ Scramble * Flashcards 9.95
T^r MUSICAL SOFTWARE 1^
ACTION PACK: Breakthru * Target +
Catterpillar: non stop graphic action 9.95
PINBALL: a video action spectacle with
real time flippers, chutes gates, bumpers.
tags etc 9.95
CLASSICS: Checkers * Backgammon
Board '■Piano Player, checkers vs. com-
puter or friend. Piano plays Minute Waltz
MUSIC MANIA: Try to repeat a. growing
sequence of tones. With graphics. Chal-
lenge to the best ear 9.95
^v
SYM
PET
KIM • O"® magazine publishes • APPLE
more information about
6502 based systems,
products and programs
than all of the others
AIM • combined: • OSl
P.O. Box 6502
Chelmsford, MA 01824
Are you tired of searching through
computer magazines to find articles that
relate to your 6502 system? MICRO
magazine is devoted exclusively to 6502
systems. Each month, MICRO publishes
application notes, hardware and software
tutorials, interfacing information and
program descriptions with complete
source listings. MICRO is not just fun and
games. It is the complete reference
source for all 6502 enthusiasts.
You can order twelve issues of MICRO for $15.00, or for $18.00
outside trie United States. Air mail subscriptions cost $27,00 in
Central America, $33.00 in Europe and Soutti America, and
S39.00 in all other countries.
MICRO fias been published regularly since October, 1977.
Articles that appeared in the earlier issues of MICRO may be
obtained in two bound anthologies, BEST OF MICRO Volume 1
and the companion collection ALL OF MICRO Volume 2, both
available at computer stores or from the magazine.
Si
v; %.;vg-Mr-5.f %.■■«■■ ;-; ■ ^ sj !-! ■■»; ^-! vt J-^ Vi J-!.>4'V::»4.;-t.XXXXX-><
PET Word Processor
This program permits composing and printing letters,
flyers, advertisements, manuscripts, etc., using the
COMMODORE PET and a printer.
Printing directives include line length, line spacing,
left margin, centering and skip. Edit commands allow/
you to insert lines, delete lines, move lines and
paragraphs, change strings, save files onto and load
files from cassette (can be modified fordisl^), move up,
move dow/n, print and type.
Added features for the 16/32K version include string
search for editing, (keyboard entry during printing for
letter salutations, justification, multiple printing and
more.
A thirty page instruction manual is included.
The CmC Word Processor Program for the 8K PET is
$29.50. The 16/32K version is $39.50.
Order direct or contact your local computer store.
A VISA AND M/C ACCEPTED — SEND ACCOUNT NUMBER. EXPIRATION DATE AND SIGN ORDER.
n ADD SI PER ORDER FOR SHIPPING A HANDLING — FOREIGN ORDERS ADD 10% FOR AIR POSTAGE
CONNECTICUT microCOMPUTER, Inc.
ISO POCONO ROAD
BROOKFIELD, CONNECTICUT 08804
TEL: (203) 775-9659 TWX: 710-456-0052
'•i-!-s.'^'-; ' i-;MV>«^>tufcgijM«i-tM«jg«vr^gsjvej-;u>i/
SYM ■ 1 Baudot TTY Interface
Do not let the title fool you! This article has a lot more
than just TTY stuff. Some of the techniques presented
can be applied in many other situations.
Richard A. Leary
1363 Nathan Hale Drive
Phoenixville, PA 19460
)
One major shortcoming of the KIM is
the inability to change the I/O routines
without duplicating large parts of the
monitor. In designing the SYM-1,
Synertek nicely handled that shortcom-
ing by vectoring all I/O calls through
jumps located in SYSTEM RAM. Since
those jumps are alterable by the user,
almost any I/O device handler could be
written and used with no effect on the
rest of the monitor. That fact, coupled
with the low cost of the Baudot
Teletypes such as the Model 15 led me
to develope SYM-1 I/O handlers for a 60
word per minute Model 15. Since the
SYM-1 allows additional ROMs to be ad-
ded to the board I placed these routines
in an INTEL 2716 EPROM, along with
some other system software. More on
that later.
BAUDOT TTY
First, some background on Baudot
Teletypes: A Baudot teletype uses only 5
data bits (unlike the 7 used by the ASCII
Teletypes such as the Model 33) and
thus it can only generate at most 32 uni-
que code combinations. In order to ex-
pand that character set, two of the
codes have been assigned special car-
riage shift functions much as it is done
in a conventional typewriter. These two
codes are called letters (LTRS) and
figures (FIGS) and refer to the "lower-
case" and "uppercase" character sets.
Unlike a conventional typewriter, it a
Baudot teletype is sent a LTRS code it
stays in that mode until a FIGS code is
sent. As a result of this shift method of
operation, each key, except for some
special ones, can send two different
characters to another Model 15 TTY
depending on the last shift sent. The
receiver must of course remember what
the last shift sent was, and print each
succeeding key accordingly. While the
Teletype does that remembering
mechanically, it is obvious that a com-
puter could easily do it electronically.
That principle is the keystone of my soft-
ware approach.
I mentioned that some keys or codes
are assigned unique meanings
regardless of whether a LTRS or FIGS
code was the last code sent oi' received.
In most Model 15 Teletypes those
special keys are:
LTRS, FIGS, CAR RET (RETURN)
LINE FEED, SPACE, NULL (BLANK)
the net effect Is that of the 32 code com-
binations, 26 have dual meanings. As a
result, 2x26-1-4 = 56 unique characters
can be printed on most Model 15
Teletypes. Note that I did not include
LTRS and FIGS in the abovei total, as
they are not really characters.
It should be obvious that with only 56
unique characters possible a 64, 96, or
128 character ASCII set cannot be
directly generated or printed by a
Baudot Teletype. The approach I used is
an indirect approach which, much like
the LTRS and FIGS codes, uses a se-
quence of codes to represent a
character.
Hardware
A few points about Baudot Teletypes
are appropriate before we begin. First,
the electrical characteristics oi a Model
15 are a bit different from those of a
Model 33 ASCII Teletype. Rather than a
20mA current loop, a Model 15 usually
has a 60mA current loop. Even more im-
portantly, the supply voltage specified
for that loop supply is usually 150v or
more. Making a direct interface to the
SYM-1 at those voltage anc current
levels would be disastrous. The answer
to that problem is to use the conven-
tional 20mA interface of the SYM-1, but
to couple it to the Model 15 through
opto-isolators. The opto-isolators will
protect the SYM-1 and allow easy con-
version of the signals to the Model 15
voltage in that the SYM-1 signal ground
can remain isolated from the Model 15
ground. Since Model 15s are notoriously
electronically noisy, the benefit of that
isolation is that the probability of noise
problems In the SYM-1 is sharply reduc-
ed.
The schematic of the interface I used
and the power supply I built are shown in
Figures 1 and 2. The only critical com-
ponents in the interface are the selector
magnet driver transistor and the zener
diode. The voltage rating of the tran-
sistor must be high enough to withstand
the open circuit loop supply voltage. The
zener across that transistor must be
similarily rated, as its function is to
damp the magnet induced voltage
spikes (positive and negative) and thus
protect the driver transistor. The
transformer in the power supply is not
critical as long as it can supply 60mA
continuously. This is a good opportunity
to use one of the old "tube-type" power
supply transformers that you probably
have in you junk box.
The total resistance value of the
series dropping resistors in the power
supply may have to be altered if the open
circuit voltage of your supply is higher
than the approximately 190v put out by
my supply. Once the supply is built, the
variable resistor is adjusted to give a
60mA loop current when in the local
mode and when no key is depressed.
Second, not all Model 15s are the
same. There is a wide variety in code vs
character terms, as well as in speed. At
least three different speed Model 15s ex-
ist. For example, my machine was at one
time a "weather" Teletype and had a
special character set tor most of the
FIGS shift positions. I converted most of
those keys and type elements to the
"standard" communications set. I did
leave in some characters which are not
standard, and hence a few characters
which I can print will have to be changed
for a standard machine. Those
characters are:
'f - on standard
-I- " on standard
Null on standard
The software changes required to ac-
comodate the standard code are minor.
November, 1979
MICRO ~ The 6502 Journal
18:49
Finally, the Baudot machines have a
few good and bad overall points which
each user must consider before taking
the plunge. They are:
a. Cheap: $50 -$100 or less should
get you a good Model 15. Insist
on a synchronous motor rather
than a governor regulated
motor,
b . Slow: 60 wpm translates to 45
Baud (6 char/sec) which is a lit-
tle bit faster than one half the
speed of a Model 33. The effec-
tive speed is even slower due to
the necessity to send LTRS and
FIGS shifts on an irregular
basis.
c . Reliable: The Model 15 Is pro-
bably 70% steel and 20% cast
iron with a smattering of
nonferrous materials. It just
does not break if kept
lubricated. (Remember— the
Model 15 was the mainstay of
the 24 hour per day news wire
services.)
d . Heavy: All that iron!
e . Smelly: All that lubricant!
f . Repairable: If it does break,
parts are available and the
manuals are complete and ex-
plicit. I buy my parts from a
company called Typetronics,
Box8873, Fort Lauderdale, FL
33310. Prices are very
reasonable and the response is
nearly instantaneous.
NOTES:
1. Resistors %w,5%
2. Open circles with
numbers are TTY in-
ternal terminals.
POWER
3A
SLO-BLO
Figure 1: Interface Logic
A-U <}
A-R <!■
A-T <}
The most difficult part of the hardware
interface has already been described.
Once the interface hardware is built it is
connected to the standard current loop
I/O pins on the SYM-1. The only SYM-1
hardware change required Is a jumper
change if you place the interface soft-
ware in an EPROM and mount it on the
SYM-1 as I did. Any of the empty ROM
sockets can be used. Which one you use
will depend upon whether you may have
already installed the BASIC ROMs, the
EDITOR/ASSEMBLER ROM, or some
other device. I placed my 2716 in Socket
U21 and since I had set the starling ad-
dress of the software to $9000, I remov-
ed two jumpers and added a new one to
enable U21 for $9000 to $97FF.
Regardless of what you do, the SYM
manual gives a complete description of
the jumpers and how to set them for
various ROM-Address combinations.
Figure 2: Power Supply
HEP
Z0445
200V
2N390 I • •
HEP
S3021
MlmA
12 46LOOP
-O SUPPLY
LOCAL
500MF
15V
NOTE:
1. Signal and power
ground isolated
Software
Given the character set limitations of
the Model 15, the first software design
requirement I had to address was how to
represent the full ASCII character set
when printing, and how to generate that
set when using the keyboard. Let's look
at the output case first.
The first decision was to convert all
lower case alphabetic characters (a to z)
to upper case. As the software will later
show, that is a simple step. Moreover
that approach does not create large pro-
blems in application, since the need for
lower case alphabetic characters is
limited unless one is doing word pro-
cessing. If that is the case I doubt that
the Model 15 is the answer in any case.
The second decision was to print
those characters not normally printable
by a Baudot Teletype as a four character
sequence, beginning and ending with a
period. For example, an equal sign ($3D)
would be printed as the sequence .EQ..
In addition, of the 32 control codes
which the ASCII can represent, I decided
to recognize only RETURN, LINEFEED,
BELL, and NULL. All others are ignored.
The decision as to how to generate
the codes from the keyboard was a bit
trickier. The approach selected was to
use BELL as an escape character. This
simply means that once the character is
entered, the following entry or entries
are handled in a special way until certain
conditions are met. While any key could
be used, BELL has the advantage of be-
ing seldom used as an input character
and thus its use as an escape character
is not a big loss. As will be seen later, it
is not a loss at all as I can still generate
a BELL as an ASCII character.
In the software which I created, the se-
quence following the escape character
is only one or two key strokes in length.
In fact it is only two when a LTRS must
be entered between the BELL and the
operative key. To better understand how
this works, consider the following two
examples which show both an escape
sequence using a key, and the normal
mode for that key:
USER TVPES
BELL
H
FIGS
BELL
LTRS
fl
ASCII OUTPLIT TO SUPERNOH
none
= '-$2
>C' .•
1
: ■:;*:
:.H.
;i
fl '::*4i:
;i
riOTie
Tior'ie
r"ione
SOH ■:
:ti
31)
As the examples show, the BELL— (char)
sequence generates the special
character while the character by Itself
generates that character. The complete
table of both input and output character
translations is contained in the follow-
ing table. LTRS and FIGS shifts are ob-
viously required for some of the se-
quences shown, but have been omitted
for brevity. Note that while lower case
alphabetic characters cannot now be
generated, it would be easy to add a dou-
ble escape feature In order to do that.
TRHNSLaTIOH
Tf-iBLE
FiSCII
IrlPUT
OUTPUT
HULL
MULL
;4ULL
SOH
BELL
H
st;<
BELL
d
ETX
B£l;_
r
EOT
SELL
l'
ENQ
BELL
E
PICK
BELL
F
BEL
BELL
G
BELL
BS
BELL
H
HT
BELL
I
LF
LINEFEE.:-'
LINEFEED
MT
BELL
K
FF
BELL
L
CR
CFiR RET
CFiR RET
SO
BELL
H
SI
BEl-L
n
DLE
BELL
P
DCl
BELL
';!
DC2
BELL
R
DC:3
BELL
q
DC4
BELL
T
Nmk
BELL
U
SVH
BELL
1.,!
ETB
BELL
I..I
CAN
BELL
y.
EN
BELL
\.'
SUE
BELL
7
ESC
BELL
BELL
FS
BELL
1
GS
BELL
2
RS
BELL
3
US
BELL
4
SPACE
1
SPRCE
SPACE
BELL
.QT.
#
#
#
*
t
■t
y.
BELL
.PC.
1
2
BELL r
+
. flS.
8
8
S
9
■3
■?
s
i
<
BELL
-
.LT.
=
BELL
:
.EQ.
>
BELL
+
.GT.
7
-y
«
BELL
&
.RT.
R to Z
fl to
Z
fl to
C
BELL
i
.LB.
V
BELL
i
.BS.
]
BELL
)
.RB.
t
t
BELL
SPRCE
.UN.
>
BELL
$
.RG.
a to z
fl to
C
BELL
,
.LP.
1
BELL
!
.US.
>
BELL
t
.RP.
'V
BELL
#
.TL.
Dt:L
BELL
NULL
.DL.
Software Implementation
I wish that I could report that the soft-
ware Is very compact and that It uses a
great deal of the SUPERMON routines.
While the software is not large, at about
1/2K it is not small. On the other hand,
the only SUPERMON routines I use are:
SAVER @ $8188
RESXAF @ $81 B8
RESALL @ $81 C4
DLYH @ $8AE9
Also, I use the following RAM and
SYSTEM I/O locations:
CHAR @$59 used like SUPERMON
does,
TTYMDE @ $100 curremt shift
position,
PBOA @ $A402 I/O port,
PBDAh- 1 I/O port direction reslster,
SDBYT @ $A651 timing constant.
As the complete listings Indicate, the
two top level routines for input and out-
put are ASCIN and ASCOUT respective-
ly. Each of these routines calls other
routines to do the actual input with the
Teletype. The functions of each routine
and Its general characteristics are sum-
marized in the following chart.
November, 1979
MICRO ~ The 6502 Jotirnal
18:51
ROUTINE
FUNCTION
Ih-IPIJT
OUTPUT
ALTERS
CALLS
flSCIN
aet- input for-
none
FiSCII
R.. F
SRUER
full char set
char- m
CHRIH
usiTia escape
R
f;:es;-;rf
se=iuerice
RSC:01JT
print- SF-ecial
RSCII
none
ncif-ie
Sfl'..'EF;
•Ee=ii.4erice=- or
char- i n
i:;i-^RnlJT
direct char
R
RESRLL
to CHRUUT for-
RLTOUT
output
CHRIN
Set Key.' echo
i::ttv
ASCII
R.. F
SRUER
and coni-.'er t
Key)
char in
TT'.-'MDE
HHLF
to RSCII
R
CWRR
F-ULL
"T'v'OUT
CHROUT
convert RSCII
ASCII
none
TT'-.-'MDE
SRi-ER
char- to Bai-Jdot.
ch-Br i r"i
TT'.-'OUT
and handle
R
RESflLL
mode chan:3e-=-
TTVOUT
output Baudot-
E-audot
i::ttv
PBDR
FULL
char
c-h-ar i n
ft
typ-e ::■
PBDH+1
H..F..J^;
'-,-'.. TTVMDE
HRLF
de 1 ay 11 ras-
none
none
t---i
IjLVH
FULL
delay 22rfr=.
Conclusion
none
Diea.
none
se feel fre
e to contact n
DL'-/H
ie. And if
I fiope that you find tfiis package
useful. If any questions need answering,
anyone would like the code translations
changed I would be glad to reassemble
the software and provide the revised pro-
Note that SDBYT must be set to $2D
before using these routines as that
parameter is used by DLYH as a timing
constant. For teletypes running at
higher speeds, either the value of SDBYT
or the loop values used in HALF and
FULL should be reduced. If your
machine is running slightly faster or
slower than mine the input or output
may not be completely reliable. If that is
the case, adjust SDBYT up or down as
appropriate, until all functions work er-
ror free.
In my system the first routine in soft-
ware is used to set SDBYT and alter IN-
VEC and OUTVEC to point to the Baudot
routines. That is not absolutely
necessary, but does make the start-up
process somewhat easier. All I have to
do is enter G9000 CR on the SYM-1
keyboard and the Baudot I/O package is
up and running.
One point of emphasis— as written,
this software includes an internal echo
for each input. The input sequence is
echoed literally. This means that if an
escape sequence of BELL / is entered,
what is echoed is precisely that and not
the .PC. which would be output if the
SYM output a %. It would of course be
possible to change that approach. A
translated echo would be a bit slower
since each escape sequence would be
echoed as six or seven characters due to
the .XX. sequence and the necessary
shifts.
gram in listing form for the cost of the
materials and postage. Good Luck.
00013
9000
20:36SB
BEGI.M
.TS,'::
HCCESS
,j-^_^.,._f_ ,^
00130
;-5VM-l
BHUDOT
TTV I-O
PhCI<:.FiGE
300.3
fl?::!'
LC'fl
#-*2i;'
char,.-ja ■'. i.-r
0000
9005
305 1H6
STR
SDB'v'T
.L/-i S-_-l^ -li"--; --
0000
0000
;Fi>;ed
P=ir.arriet
■*Ti
9003
fl9:35
LDR
ttflSCOCT
ijt
Jjjc. F,:,i,,T
900hl
SD64H6
STFl
OUJiJEL 1-
t-_ ^- '-.
0000
HULL
=0
9000
fl990
LDR
#li:3CijiJT
2'=;,.
ry; :^
0000
FIGMDE
=0
900F
8D'i5Fl6
STfl
OUTi.iECt-.
, .-„ ,; 1,
0000
BELL
=7
9012
FI910
Lon
*t!=iic;:i-f:
ji--. -
1'56 r, -.,-, , 1-
0000
ESC
=-*lB
9014
8Dilfl6
STi-i
IMi.iEC H
L, ir- .f-
0000
FIGS
=-*lB
9017
R990
LDm
#RSCIM. .
^„
":'•.: ;:■"■-
0000
LTRS
=-*lF
9019
SD62fl6
STFl
PJi.CC-H
-■.'"- 1
0000
SPACE
=-*20
9010
60
Rf'S
t.,-a;-i r-af'-ii
0000
LTRMDE
=-*20
901 D
0000
0000
DELETE
=-*7F
90 ID
;RSCi I
Ir,F-.
it-
'
901D
; ij-;ea
BELL -a-; a=-caFS-
iharacta'- t.
0060
;S-d = tem RAM \M
=. .1 arifNen t
=
9eiD
; -Sent-
-aC-a
f I.I 11 flSC
:II
iha,- =-;.'.a! ±
0000
i
90 ID
; e;;ce
= t f-
'r- lo'...!ai-
':a =
a a i F F,-^ „
0000
CHRBLIF
=«F-3
character- bi.iffer-
9010
0000
TT'.'r-tOE
=-*100
J-T'i-' ah if I mode
90 ID
2SS881
HSCIH
JSR
Sfli-.iEP
^.9.....=. r-aiil 1 Hi
0000
SDE:',-'T
=*fl.;51
tli-|-iiriJ coriatafit
9020
2eEB9e
-JSP
CHPIH
:ae-f. r|-iar
0000
IfJUEC
=*H66U
inPLjL ji.jiiiF '.,'eci.cif
9023
C'iO?
CMP
#eELL
If net BCL
0000
OUTUEC
=«Rt't.3
C".4-i-. F i.jt -juiiiF '..sector
9023
DeiB
BHE
E;--:TfiIN
thai-; . a*. -;r
0000
;
9027
2eEB90
ESCAPE
JSR:
CHRIt-l
aet iiacj-d
0000
;SiJPERr
CM RoLi-
1 Pie i
902fi
C?i07
CMP
#BELL
If -lot rCL
0000
;
902C
0604
BNE
NOTESC
ti-iah ji.^f.-.F
0000
SRi.iER
=*:ilS:3
reJla;..ar aav'.^
902E
ff51B
LDfl
#ESC
aet ESC c-
0000
RESKHF
=*sies
reatoi-e ta:--;ceFt HUP
9030
0010
BUE
EXTRIN
ariid rat-i,4r-n
0000
RESflLL
=-*SHC4
riii,-1..jr iEf re3i=tart
9032
C?i00
HOTESC
CMP
#NULL
if not ML
0000
DLVH
=*-3hE'?
de 1 a-j
9034
0004
BNE
MOTDEL
tr.ari ji.ir.iF
0000
FiCCESS
=*;3BSC
ur, "Ft ot i-jat.a,.i Rfirl
9036
fl=i7F
LOR
#DELETE
elaa ^aat [■
0000
i
9038
DCI0S
Bt-C
EXTfllN
arid rat'.jrr,
0000
--I--0 Ds
■.'ICc-i
903H
c-;;2e
HOTDEL
CMP
SPfiCE
If la== th
0000
;
903C
9t)E9
BCC
ESCAPE
tr-J aaair.
0000
PEDfl
=«ii4Ci.:
irV FCii-t.
9e3E
fiFi
TRK
ri'io'.'a char
0000
i
9yji-
604590
LDfl
flscii,:-:
and aat t,-
0000
;I.O UE
CTOR i;
iTir-iLl^fl
TlJh
9042
4CB3S1
EKTRIN
JMP
RESXflF
r ۥ-= tor a an
0000
;
904-5
5F-
RSCII
. BY
IE *5F ,. X~
"C -. t
.*7E,*t-e.-Q..
'i^000
■f
=^-?00Cl
9046
Tt:
oda
18:52
MICRO — The 6502 Journal
November, 1979
ga^ ,-
ytJ
9043
7E
964='
60
904R
00
9046
40
904C
22
904D
5E:
904E
5D
904F
00
9050
3E
9051
7D
9052
3C
9053
7B
9954
25
9055
00
9056
IC
905"
ID
9058
IE
9059
IF
905fl
00
905B
00
905C
00
905D
00
905E
00
905F
3D
9060
5C
9061
00
9062
00
9063
00
9064
00
9065
00
9066
01
9067
02
9063
03
9069
04
9e6.R
05
906E:
06
906C
07
906D
03
906E
09
906F
0fl
9079
0B
9071
ec
9072
0D
9073
0E
9074
0F
9075
13
9076
11
9077
12
9073
13
9079
14
9a7H
15
9VJ7B
16
17
IS
907C
907D
9e7E
19
907F-
IH
9030
00
903 1
Otl
9082
00
9033
2fl
90;34
00
J
9yo5
9035
90S5
9035
9035
9085
908S
903fl
903C
90SF
9091
9093
9094
9096-
9097
9099
909B
909t'
90R0
90R1
90fl4
9007
90RS
90flfl
90flD
9060
90B3
201=
51
H230
DDB390
FQvjH
fl003
Cfl
33 IH
S3
D0FR
FQFl
fl002
20E6.90
ES
606390
204F91
D0F6
20Efc90
4CC4S1
4C5491
. BYTE *5B.. *5D-. 3-. *3E . *7D, *3
. BVTE Z, -flC, *1D.. *1E. *1F.. 0, 0, a
. BVTE . 0.. *3D.. *5l:.- U.. 0.. 0..
.BVTE 0, 1,2. 3,4,
.B'r'TE S,
, *R,*6, *C, *D,*E, -fF
. BVTE *ie, *1 1 , *12, «13, *14, *15, tl6, *17
-B'.TL *l::
F^CII OutFut.
Out F'.li £ .-Sr..^f ic-
Fr-i-it^d t.y Sr.LiL
fi
:Jj. jtt
ded t-:
- .: !-,.=,- act
IHFGUT i-
J3R SiiiJCfi: ;..a',
HUD #J,'F .„.ai.;
LC•;^'#Li^TS^-rH_LTIt23'
TSTCHF: CMP MIJLTI,:-
BEQ 0IJT3T-:
LC'',' #3
MupnTR C'E:-:
EMI NTFMC'
DE','
BHE MiJF'NTF:
EEC! TSTCHF
OUTSTR LD'.' #2
JSR PRDClUT
h;<tijut im;,
ldh multi,:^
JSR CHROLiT
DE','
BNE h;<tout
JSR FRCjOUT
JMP RESRLL
HTFND JMP RLTOUT
MULTI .BVTE '"QT
t e £
if ,i,jt._n
■- Oijnt. ijoiii
^.jriCil i i ..'
tl-ii-r, A-j t
H.end Fir i
and d.;t. c
ar,d i=nd
looF .jnt 1
ai 1
+.:-
TF t.^.^r n
9064
51
9065
54
90B6
25
. B',-'
TE --VPC
9ete7
50
9063
43
90B9
2R
. BV
TE -^RS
99efl
41
90BE
53
9060
3r:
. BV
TE -^LT
9eBD
4i:::
906E
54
90BF
3D
.B','
TE ■■=EQ-
90CQ
45
90C1
5:.
90C2
3E
. B'l'
TE -)GT-
90C3
47
90C4
54
9005
40
.B'i'TE -('FIT
90C:6
41
90C7
54
9003
5B
. BV
TE -CLS
90C9
4C:
90CR
42
90CB
5r:
. BV
TE --BS-
90CC
42
9eCD
53
90CE
50
.BVTE -]RB-
90CF
52
9000
42
9001
5F
.BVTE --UH'
90D2
55
9003
4E
9004
60
.BVTE ' 'RG
90C>5
41
9006
47
9007
7B
.BVTE -t'LP-
9003
4C
9009
50
90OR
7C
.B'r'TE ■ ;i.i3-
9006
56
90OC
53
9000
7D
.BVTE -."IRP-
90OE
52
90OF
50
9ee0
TE
.BVTE ■TL'
9eei
54
90E2
4C
90E3
7F
LSTSQ
.BVTE DELETE
90L4
44
.BVTE 'DL-
gees
4C
90E6
90E6
;Out.-Fut Period
90E6
9ee6
fl92E
PRDOUT
LDfl
# .
Jet Ftrijd
90E3
4C4F91
Jt-tP
CHROLIT
ac do it
90eB
i
9eeB
; Char a
:t.F-r
Input.
90EB
; Get-s
IhF
jt. from ERUD
jT t'.eab.jai d
9eee
; and
;or-i'jert.;. t..C( RSCI
I and F.:i-,c,;
9eeB
; char
act*
90EB
J
90EB
203381
CHRIH
JSR
SRiJER
Ea','e re:3i stef i
90EE
0900
flC3HlN
LDH
#t)ULL
clF-ar buffFi-
ytfro
3SF9
STfi
CHF;EUF
in RRM
90F2
2C02H4
LOOK..
BIT
PBOfl
t..F-E.t. f.-_il =.i..ar-t.
90F5
50FB
BUC:
Loot..
if not. IcoF
90F7
200292
JSR
HRLF
els.-s wait ,^ialf
yk»-fl
2C02R4
BIT
PBDfl
and t..e = t a=lair
90FD
50F3
BUG
Lijut;
if fali.F- E.ta-.L
90FF
0007
LDV
#7
Jet. se'-'en bit;
9101
200692
NXTIH
JSR
FULL
wa 1 1 b i t.- + 1 -,u^
9104
2C02fl4
BIT
PBDR
t.^Ft, iriFut
9107
18
CLC
S 1 f n.:. 0'.,f 1 .1
9103
5001
B'.iC
SRtiE
Fa^..'e if Ci
9101=1
33
SEC
el=-F. i£ i
910B
66F9
SfiUE
ROR
CHRBUF
E.hift. i,-,t.';. Luf
9100
33
OEV
COI-JFiC dCii...iri
910E
D0F1
BHE
NKTIM
lOOF if ;jiOi-F
9110
FI5F9
LDR
CHRBUF
3s.t chai-
9112
4fl
LSR
R
•and finish Fhi
9113
49FF
EOR
#tFF
ccifiiF lefiierit
9115
291F
flHD
t!*lF
Jet 5 da*, a di'.
9117
43
PHR
E.a'.'-a c.Fia>
9118
2ldt091
JSR
TTVniJT
then ec!-,o
9118
63
PLR
restore chai
911C
C91F
cr-ip
#LTRS
if not LTRS
911E
D00S
BHE
NOTLTR
then juruF
9120
0920
L[:'fi
#LTPMC:€
Jet LTRS iii.jde
9122
800001
SETMOE
STR
TTVMDE
and Eet n,.;..de
9125
4CEE90
JMP
RGR I H
then try a^ai-
9123
C91B
NOTLTR
CMP
#FIGS
if not FI2.-
912fl
0094
BHE
HOTFIG
t-hen ._iur„F
November, 1979
MICRO — The 6502 Journal
18:53
912C fi^ee
LDR
#FIGMDE
3et FIGS mode code.
912E F0F2
BEQ
SETMDE
and set
9130 13 NOTFIG CLC
clear carry
9131 SDQeei
RDC
TT'v'MDE
conuert to table-
9134 35F9 TRVOTH STH
CHRBUF
and sa'...'e-
9136 fl25F
UjK
#■55
number char - 1
913S BDSe91 ;
ERRCH LDR
BRUC'OT ■
; aet tab 1 e entr-j
913B 293F
RND
«*3F
look at mode+data
91 3D C5F9
CMP
CHRBUF
if saffte a=. buffer
91 3F Feen
BEQ
FOUND
then found
9141 Cfi
de;<:
el^e count down
9142 10F4
BPL
SEhRCH
and looF until all te
9144 fl5F9
LDR
CHRBUF
aet char
9146 4920
EOR
«LTRMDE
coriip 1 efiient riiode
9 143 4C3491
JMP
TRVOTH
and try aaain
914B 31=1 FOUND TXfl
rno'-'e RSC II to R
914C 4CB:381
JMP
RESKRF
and return
91 4F
914F
Output Sinale RSC
1 1 Char actei-
914F
Con'., arts
to BRUC
jT and har.ijle=.
914F
; riiode changes a=
re=)uired-
914F
914F 20SSS1 C
JHROUT JSR
SRUER
i.a'...'"a reai=.ter =
9152 297F
RHD
#*7F
riia=.t.. out rii=.ti
9154 C960 ^
ILTOUT CMP'
»*60
if UFPer ca=.e
9156 9602
BCC
UPRCSE
=.K ^ F cionv'er t
9158 29DF
flUD
«*DF
el=.e rna^-.e UFFer
915R m 1
IPPCSE TRX
make char pointer
9156 eD8091
LDH
BRUDOT..
X aet BRUDOT
915E C9S0
CMP
»*S0
If msb=l
9160 B01B
BCS
NOPRNT
do not Frii-it
9162 C940
Cr'tP
#*40
if ne..;t bit=0
9164 9014
BCC
NONDE
no mode ch.ariae
9166 43
PHR
el =.e =.a'.'e char
9167 2920
RHD
#LTRMDE
look at. mode bit
9169 CD0e01
CMP
TTVMDE
if iarne
916C F0eB
BEQ
HOCHNG
then rio c hi.anae
916E 3D00O1
STR
TTVMDE
el =e =.a'...'e
9171 4R
LSR
R
move to
9172 40
LSR
fl
correct
9173 4fl
LSR
fl
Foiition
9174 09 le
ORR
«FIGS
con'jert to ci't=ir
9176 2eE091
JSR
TTVOUT
and send
9179 63
CiCHHG PLR
aet char back
917n 20EQ91
JOMDE JSR
TTVOUT
send i t
917D 4CC4SI f
-lOPRMT JtV
RESHLL
and return
9180 60 BRU
'01 .E'.TE
*60.. tFF..
*FF , *FF .. tPF . *FF .. *FF . t4
9181 FF
9182 FF
9133 FF
9134 FF
9135 FF
9186 FF
9137 45
91SS FF
. BVTE
tFF,, *FF..
2,*FF,*FF..3..*FF,*FF
9139 FF
913n 02
91SB FF
913C FF
91 3D 03
918E FF
918F FF
9190 FF
. BVTE
tFF..*FF,
*FF . *FF . *FF .. *FF , *FF . tPf
9191 FF
9192 FF
9193 FF
9194 FF
9195 FF
9196 FF
9197 FF
9193 FF
. BVTE
*FF..*FF
*FF ., *FF . *FF . tPF . *FF .. *F
9199 FF
919fl FF
919B FF
919C FF
9190 FF
919E FF
919F FF
91fi0 04
. BVTE
4. *4D. «FF , t54.. *49. *FF. *5R. *4e
9101 40
9102 FF
9103 54
9104 49
9105 FF
9106 50
9107 4B
9108 4F
9109 52
9100 FF
910B 51
9 IOC: 4C
910D 40
910E 50
910F 5D
91B0 56
91B1 57
91B2 53
91B3 41
91B4 4fl
91B5 50
91B6 55
=.,-j 91B7 47
91B8 46
91B9 58
9160 4E
91BB 5E
91BC FF
91B0 FF
9ieE FF
91BF 59
91C0 FF
91C1 63
91C2 79
91C3 6E
91C4 69
91C5 61
91C6 60
91C7 TO
91C3 74
91C9 66
91CTI 6B
91CB 6F
9 ICC 72
91CD 7C
91CE 6C
91CF 73
9100 76
9101 77
9102 60
9103 65
91D4 70
9105 67
y 1 Db .'t
91D7 73
9 IDS 7D
91D9 75
9100 71
9 IDE FF
91DC FF
91DD FF
91DE 43
91DF FF
91E0
91E0
91E0
91E0 0220
91E2 3EI33R4
91E5 29 IF
91E7 0940
91E9 49'-F
91EB 33
91EC 2R
91 ED 0008
91EF 4R
91F0 43
91F1 0900
91F3 9002
91F5 0920
91F7 3C02R4
91FH 68
91FB 2010692
91FE S£:
9 IFF D0EE
9201 60
9202
9202
9202
9202 o:;0e
9204 D002
9206 re: 16
9208 2C»E98R
920B 4fi
920C 65)
920D CO
920E D0FS
9210 6(3
9211
. BVTE *4F ■ *52.. *FF.. *51 .. t4C. ■*40 . tt
. BVTE «56 .. *S7 .. *53 .. *4 1 , *4fi .. *50 .. t^=
SVTE t46.. *5
. *4E.. tSE.. *FF .. *FF , *FF . SZS
. BVTE *FF . *63 .. *79 .. *6E .. *69 .. *6 1 , *6D .. *?fl
. BVTE *74.. *66 .. *t.e .. *6F .. *72 . *7C .. *6C , *73
.BVTE S76.tT
, ten .. *65 .■ *70 .. *67 .. t7E .. t73
.BVTE *-
BRUDOT Output
TT'v'OUT LDK »*20
ST;^: PBDR+1
RND «*1F
ORH #*t.3
EOR «*FF
SEC
RUL fl
LD',' #8
NXTEIT LSR fi
PHR
LDR #0
BCC OUT ONE
ORR #*2ei
OUTONE STfl PBDfl
PLR
JSR FULL
DEV
BHE HKTBIT
RTS
it Timina Routines
HALF LDX #11
BNE T I ML OP
FULL LDX #22
TIMLOP JSR DL'v'H
PHR
PLR
DEX
BNE TIMLOP
RTS
. END
set Fori t...
OLJtF...it ,i,ode
look at Jat ^ bit;
add 2 St OF biL e
coriiF leriis.rit
set -Etat I L.iL
aet resdy
mo'.'e lib K-j C
= =,->'i char
cles
if no car- r SI .jL.r.
el=e set bit
ser.d to Fort
aet chi.ai- ba.:;,
del. ay one bit
then count dowr
i f mor e tl'ieri 1 .:
else -luii.
hia 1 f per 1 od
ao do It
full period
de lad i rtis
fill
count doi.-.Ti
and loop
unt 1 1 done
18:54
MICRO ~ The 6502 Joyrnal
November, 1979
The MICRO Software Catalog: XIV
Mike Rowe
P.O. Box 6502
Chelmsford, MA 01824
Software Catalog Note
This regular feature of MICRO Is provided both as a service to
our readers and as a service to the 6502 industry which is work-
ing hard to develop new and better software products for the
6502 based system. There is no charg'S for listings in this
catalog. All that is required is that material for the listing be
submitted in the listing format. All info should be included.
We reserve the right to edit and/or reject any submission.
Some of the submissions are starting to get much too long.
We might not edit the description the same way you would, so
please, be brief and specific.
Name:
Environment for KIM BASIC
Name:
System:
KIM running Microsoft BASIC
System:
Memory:
1.2K
Memory:
Language:
Machine language
Language:
Hardware:
any KIM that runs BASIC
Hardwfare:
Description: This software package provides the follow-
ing utility programs for use with KIM BASIC: Renumber,
Range Deletion, Append, Character-Oriented Line
Editing, Automatic Line Number Prompting, Controlled
Listings. The package is configured to interface itself
automatically with any version of 9-digit KIM BASIC
upon execution. There are no restrictions on length of
internal references in lines; you can renumber from
1,2,3, to 63000,63010 and back again. Renumbers
typical 200 line program in less than 10 seconds. Range
deletions (i.e. Delete 100-950) take approxomately 5
seconds per 100 lines deleted. One POKE makes the
next LOAD an APPEND and then restores regular LOAD
status. All functions have complete error checks before
changing your original program and report errors using
BASIC'S own error messages. Page length can be varied
during listing or command mode at any point. Edit mode
allows moving lines in the program or changing one sec-
tion of a line without retyping the complete commented
source listing.
Includes:
Price:
Author:
Available from:
J
KIM format tape, source, manual
$20.00 plus $1 .50 shipping and handl-
ing. California residents add 6%
sales tax.
Sean McKenna
Sean McKenna
64 Fairvlew Ave.
Piedmont, CA 94610
MEM-EXPLORER
Commodore PET
8K or more
Microsoft PET BASIC with
machine-language subroutine
PET 2001-8, 2001-16, or 2001-32
6502
Description; MEM-EXPLORER gives the PET owner a
"window" into his computer, to give an understandable
view of memory contents— both user (RAM) and Inter-
preter/OS (ROM). When the program is run, you are ask-
ed for a starting location. MEM-EXPLORER then
presents information on 20 bytes of memory, starting
with the location you specified. In the left column is the
addrejjs of the byte, while columns to the right hold the
decimal value of its contents, the character equivalent
(or BASIC token, if appropriate), and two different two-
byte values (address, integer). By specifying the area in
RAM vi/here the BASIC program is stored, you can ac-
tually see the program "listed" vertically in the
character column, and tell exactly where every
character or token is stored. MEM-EXPLORER includes
routiness that allow it to be combined with your pro-
grams automatically.
Copies: Many
Price: $7.95 (quantity discount available)
Includes: Cassette in Norelco-style box,
description, operating instructions,
and zip-lock protective package.
Designer: Roy Busdiecker
Available from: Better computer stores, or directly from
Micro Software Systems
P.O. Box 1442
Woodbridge, VA 22193
November, 1979
MICRO — The 6502 Journal
18:55
Name: Space Shuttle Landing Simulator
System: APPLE II
Memory: 48K
Language: Assembly and Applesoft II
Hardware: 6HIRES color APPLE and Applesoft II
ROM card
Description: Modeled after tine real Shuttle Mission
Simulator, this program is a real flight simulator. The
HIRES screen shows the "out-the-window" view using
animation, projective geometry, and high speed
assembly language graphics to display the image of the
runway, sky, mountain, clouds, etc. In text below the
screen Is the flight data plus warnings and messages.
Real flight algorithms are tailored to the Shuttle
Orbiter's flight characteristics providing realistic stick
response using the game paddle. Functional features
are: full stall capability, ejection, landing gear, speed
brakes, and wheel brakes on roll out. Runway stripes on
roll out give a speed indication. The instruction manual
is 10 pages, over 3500 words, and provides a brief in-
troduction to guiding flight.
Name: APPLE II Sweet 16 Assembler
System: APPLE II
Memory: 16K RAM, Cassette Deck
Language: Machine and Sweet 16
Description: This system is a co-resident, two pass
assembler for Sweet 16, the 16 bit software processor
resident in the APPLE II Rom. The assembler has full
cursor editing capabilities identical to those of
Applesoft, English Language error messages, and line
length up to 255 characters for extended program
documentation. Commands are included to read and
write the text file to tape, display the input format,
renumber lines, list text file, return to APPLE monitor,
and to assemble. The assembler supports pseudo OPS
to determine ASCII strings, define hex strings, label
location, and define program origin. The assembler lists
addresses, object code, source code and symbol table.
Included with the program is full documentation for use
of the assembler, plus a full description of all Sweet 16
OP codes andlB bit registers and short programs il-
lustrating each operation.
Copies:
Just Released (20 Aug 79).
Copies:
Just Released
Price:
$15.00 ppd. New Mexico residents
Price:
$15.00
add 4% sales tax.
Author:
Steve Cochard
Author:
John Martellaro
Available from:
Available from:
Scientific Software
Harvey's Space Ship Repair
P.O. Box 156
P.O. Box 3478
Stowe, PA 19464
University Park
Las Cruces, NM 88003
Name:
AMPER-SORT II
System:
APPLE
Name:
XMON, an extended monitor for TIM
Memory:
32K minimum
System:
any version of TIM
Language:
Assembler
Memory: minimum 512 bytes
Language: 6502 assembly
Hardware: Mimimum TIM plus 2708 addressing
and comparitor with 5 discretes; op-
tional LED and 2 discretes.
Description: Nine commands from terminal provide: fill
memory with constant; move, compare memory blocks;
search for string; go execute with breakpoint and single
step trace; exit to TIM monitor; load and dump KIM for-
mat cassette at 4K/min. All functions externally
callable; suitable for calling by TINY USR function.
Standard version resides ECOO through EFFF.
Copies:
Price:
Includes:
Author:
Available from:
Just Released
$28.00 for standard version. Add
$7.00 for relocation.
2708 PROM, comparitor and
discretes, instructions, schematics.
Phil Lange
206 Santa Clara Ave.
Dayton, Ohio 45405
(513)278-0506
Description: AMPER-SORT II is an enhanced version of
the AMPER-SORT routine published in MICRO, number
14. Two major enhancements improve sort speed and in-
crease its versatility. The Shell-Metzner algorithm
reduces sort time and a capability to sort two-
dimensional character string arrays enables AMPER-
SORT II to be used easily with programs such as FILE
CABINET, an Apple Contributed Software Bank pro-
gram. FILE CABINET with AMPER-SORT II will sort 100
records of 3 10-byte-average fields in 3 seconds com-
pared to 7 minutes using the original BASIC sort code.
AMPER-SORT II will sort integer arrays, floating point
arrays, and one or two-dimensional string arrays. It also
features an easy-to-use BASIC interface to pass array
name and sort parameters.
Copies:
Just Released
Price:
$15.95. (California residents add 6%
sales tax)
Author:
Alan G. Hill
Available from:
PROGRAMMA INTERNATIONAL, Inc.
3400 Wilshire Blvd.
Los Angeles, CA 90010
18:56
MICRO — The 6502 Journal
November, 1979
J
Bringing IVIusic Home
"^^^^iud-
Being a spectator is great
. . .but why not participate?
• Sing along
• Compose
• Play
• Learn from Specialists
LET MICRO MUSIC TURN YbUR APPLE ][ ® INTO A FAMttY MUSIC CENTER!
VISIT THE APPLE DEALER NEAREST YOU AND ASK FOR A
DEMONSTRATION OF MMI'S MICRO COMPOSER ™
The MICRO COMPOSER LETS YOU—
• Play up to 4 simultaneous voices
• See all 4 voices at the same time you're hearing the music — a
must for music editing!
• Enter music notes by a fast, simple and well-tested coding
system.
• Program the pitch, rhythm, and timbre of the music. Tempo is
varied by the Apple paddle.
• Choose 7 different tone colors for each voice or create your
own tone color.
• Compose, edit, display, and play music through an interactive,
command-driven language that's easy to learn.
• Save your music on disk or cassette.
• Hear quality music sound at low cost through the MICRO MUSIC
DAC card. No amplifier needed! Designed for MM! by Hal
Chamberlin and Micro Technology Unlimited.
• Select from future MMI music instruction software to accompany
the MICRO MUSIC DAC.
Ask your local dealer for information on MMI oroducts, or contact;
The MICRO COMPOSER is on APPLE II® compatibiie, low-cost
music system designed by the folks at MMI. Our music software was
designed by leading experts in music education. A simple step-by-
step instruction manual leads you through entering, displaying,
editing, and playing music with up to four voices — soprano, alto,
tenor, and bass. You can change the sound of each voice to reed,
brass, string, or organ sounds and you can even color your own music
sounds!
HAVE FUNrTHE MICRO COMPOSER comes complete with on instruction manual,
software di:i or cassette — in either Integer or Applesaft ROM BASIC, and the MICRO
MUSIC DAC music card. Just plug the MICRO MUSIC DAC into the APPLE extension slot
and connect the audio coble to a speaker.
Suggested retail price $220.
^USiC InC 309 Beaufort, University Plaza, Normal, IL 61 761
APPLE II IS a trademark of Apple Computer Inc
One of the most common re-
quests I receive from our readers is
tfiat MICRO provide revlevi/s of fiard-
ware and software products. One of
the most common types of articles
MICRO receives is the product
revievi/. Why then, you may
reasonably ask, hasn't MICRO
printed lots of reviews? The answer
is simple. While some other
magazines print product reviews as
filler material, I feel that a product
review is a very special trust and
must be handled in special ways. I
feel that any review printed in
MICRO should be as accurate, un-
biased, and complete as possible,
and that the qualifications and
potential "conflicts of interest" of
the author should be known.
Unsolicited Reviews
Think for a moment about the un-
solicited reviews MICRO receives.
Why did the author write the
review? Probably for one of two
reasons:
He loved the product, or.
He hated the croduct.
MICRO Reviewer
In either case the author is biased.
An even more serious problem with
the unsolicited review is that an
author could have a vested interest
in a product. He might be a friend of
the manufacturer of the product, or
could even be the manufacturer
himself! Another problem s that
the coverage of the possible pro-
ducts is going to be very spotty.
Since every author is free to choose
what he is going to review, some
very good products will be overlook-
ed, and some bad ones, too.
A Plan
I have come up with a plan which
I feel will permit MICRO to obtain
the types of reviews it wants and
which the readers require. Phase 1
of the plan entails getting a list of
qualified, unbiased reviewers. This
panel of reviewers would each fill
out the attached form and submit it
to MICRO. Authors would then be
selected from this group to review
products. Since the form provides a
means by which the basic qualifica-
tions of the authors may be deter-
^
mined, and since the selection
would be made by MICRO, not the
individual authors, both the
qualification and bias problems
should be solved.
Reviewer Qualification Form
Why should you become a reviewer
for MICRO? I can think of a number
of good reasons. First, you will get
a chance to try new products, often
before they become generally
available. Second, you will get a
chance to help fellow computerists
by providing the detailed informa-
tion they need to help decide on the
merits of various products. Third,
you will have your review published
under your "byline". Fourth, you
will be paid by MICRO for the
review. Fifth, you will normally be
able to purchase the product you
reviewed at a substantial discount.
If you would like to become a
reviewer for MICRO, please com-
plete and return the attached form.
Name:
MICRO Reviewer Qualification Form
Address;
City: State:
Phone: Days: Evenings:
List all 6502 Hardware you own or liave 'unlimited' access to: . .
Zip:
List Programming languages you are qualified in and can use on your equipment:
List types of 6502 applications you are interested in:
List any special equipment which your system uses/supports:
List ALL companies, stores, etc. with which you have any relationship other than as customer, and ANY
company, store, etc. whose products you do not feel you should review for any other reason:
Write a brief biography which may be published with your reviews which gives the reader a summary of
your interests and qualifications:
^
I declare that the above information is complete and accurate.
Signed: Date:
Please complete, using additional pages if necessary, and return to: MICRO, P.O. Box 6502, Chelmsford, MA 01824
J
Alarming APPLE
Paul Irwin
P.O.B. 1264, Station B
Ottawa, Ontario KIP 5R3
Canada
Here is a way to program you APPLE to respond to
errors with an alarm and keyboard lockout.
i
I
Instead of using the CTRL-G beep on
your next program, here's an alarm
system written to assist in performing
error recovery on the APPLE il. When the
alarm system is used, your program will
react to an error by immediately loclcing
the l^eyboard, sounding a continuous
two-tone alarm, and forcing the
operator's attention to an error recovery
subroutine. No way will recognizable er-
rors escape your edits once they meet
the Alarming APPLE!
To use the alarm system, start with
each of your subroutines clearly defined
as either error detecting or error correc-
ting. This means that you will classify
most of your "normal" routines as error
detecting routines. Arrange to have ail
of your routines invoiced by a mainline.
Then the mainline can invoice error cor-
recting routines, as well, and still remain
in control. This is illustrated by the pro-
gram shown here.
In the BASIC listing, the one error
detecting routine is called TASK, while
the error correcting routine is TRAP. The
mainline is free to decide what to do
after recovery: whether to continue the
same error detecting routine or to take
any other action. An intelligent mainline
of this sort can avoid, most error
recovery hassles.
The l<ey to the error recovery pro-
cedure is a machine language routine
called ALARM. It is invoked from BASIC
by executing a CALL 3529 and from
machine language by executing a JSR
$DC9. The alarm routine will then
generate a two-tone alarm continuously.
At the end of each cycle, it examines the
keyboard for a CTRL-C. If none was
found, it continues sounding the alarm.
But when a CTRL-C is typed, the sound
will stop and the routine will return. The
effect is to produce a continuous sound,
ignoring any input, until a CTRL-C is
entered.
You may have your own ideas as to
how the alarm should sound. The dura-
tion of the first tone is in $DA2 and its
period is in $D9D. The second tone has
its duration and pitch stored in $DBF
and $DBA. The two that I employ are
quite noisy, but you can experiment with
other parameter pairs. Thojie periods
that are relatively prime — having no
common factor — will produce discord.
They will be loudest when matching the
APPLE'S speaker resonance.
When loading the routines, remember
to set LOMEM greater than $DDO, the
highest location in the alarm routine, so
the two won't overwrite each other. The
BASIC routine shown here will run as it
appears, and will invoke the machine
language routine. If you are not bother-
ing with the BASIC, simply JSR $DC9.
After you run the Alarming APPLE and
decide to use it for error recovery in your
next program, consider these ideas:
Organize the program into error detec-
ting routines, one or more error recovery
routines, and an intelligent mainline.
Use an error flag in the recovery
routines to inform the mainline.
Use a status flag iin the error recovery
routines to indicate success or failure of
the recovery procedure to the mainline.
Let the mainline make all decisions
regarding what to do next.
For instance, if you are heavily into
structured programming, you might con-
sider a mainline centered on a computed
GOSUB with the returns of each routine
setting a status number pointing to the
next routine. Or you may want to use IPs
and GOSUBs tofether in the mainline as
each case is decided. The Important
thing is to route all control decisions —
decisions that answer the question:
"What next?" — through the mainline.
Including error recovery decisions. In
fact, especially error recovery decisions.
November, 1979
MICRO — The 6502 Jaurnai
18:59
BHSIC CALL SEQUENCE
FOR HLHRM PROMPT ROUTINE
1 REM
2 REM
3 REM .
4 THSK=3ayti
le GFF=y : TR5k=28ia : TRftP=3:00 : fiLHRM=2523
95 REM
9<S REN MAIN LINE SEQUENCE
97 REM
98 REM .
99 REM .
lee ERR=UFF: GOSUB TASK: IF ERR THEN GUSUB
TRRP
101 REM .
lui: REM .
lia GOTO 32767
120 REM
121 REN
122 REN
20ei INPUT ERR:
21i3 REM
211 REM
212 REM
213 REM
220 RETURN
297 REM
298 REM
299 REM
300 POKE 50..127: PRINT "ERROR"
: PRINT " TVPE fl CTRL/C"
310 REN
320 REM PUT ERROR RECOVERY ROUTINE HERE
330 REN
340 RETURN
Figure 1: Example of a BASIC program Invoking the
alarm routine in Fig. 2. 3529 is $DC9.
REM . USE FOR TEST
PUT ERROR DETECTING TfiSK HERE
REPLfiCING LINE 200
POKE 50,
CALL flLHRN
eD8i-
FF
■??■?
0D82-
FF
"?■?"?
0083-
flO
30
C0
LDH
*C030
0086-
88
DEV
0087-
00
05
BNE
S0D8E
0089-
CE
32
00
DEC
*0O82
woac-
F0
09
BEQ
*0O97
aOBE-
Cfl
DEX
0DSF-
00
F5
BNE
J0OS6
0D91-
HE
81
00
LDX
*0DS1
0094-
4C
33
00
JNP
S0OS3
0097-
60
RT5
0D98-
H0
00
LDV
#S00
0O9H-
H2
00
LDX
#*00
yD9C-
h9
47
LOh
#S47
0D9E-
80
SI
00
STR
J0OS1
0OPI1-
H9
H0
LDH
#*fl0
0Drt3-
3D
32
00
STH
*0D82
0086-
20
33
00
JSR
S0OS3
0Dfl9-
2C
00
C0
BIT
JC000
0OPIC-
10
97
BPL
*0OB5
0DPIE-
HO
00
C0
LDH
*C000
eoei-
2C
10
C0
BIT
*Cai0
0DB4-
60
RTS
0085-
R0
00
LDV
«*00
0067-
H2
00
LDX
«*00
0069-
H9
60
LDH
#*60
0DBB-
SO
31
00
STH
J0DS1
0DeE-
H9
H0
LDH
#*H0
0OC0-
SO
32
00
STH
S0O32
0DC3-
20
S3
00
JSR
*0DS3
0006-
4C
93
00
JNP
J0O98
0OC9-
20
93
00
JSR
J0O9S
0DCC-
09
33
CNR
#S83
0DCE-
00
F9
BNE
J0OC9
0DD0-
60
RTS
PVENTURE
GAMES OF HIGH ADVENTURE
FOR THE APPLE II FROM
SYNERGISTIC SOFTWARE
5221 120th Ave. S.E.
Bellevue, WA 98006
The Apventure games combine the exciting graphics and
sound effects capabilities of the APPLE II with the fas-
cinating complexity of a mythical adventure game.
Monsters, hazards, obstacles, vweapons, magical devices
and evil powers confront the player at every turn as
you gather treasure and try to reach your goal. Two
adventures are now available:
DUNGEON CAMPAIGN - Full color graphics
subterranean adventure. 16K required.
CASS, $12.50 DISK $15.00
WILDERNESS CAMPAIGN - HIRES graphics
surface adventure. 48K required.
CASS. $15.00 DISK $17.50
GET BOTH ON ONE DISK FOR $30.00
(WA Res. add 5.3% sales tax)
Figure 2: Machine language routine to
sound two-tone alarm until ctrl/C is
typed. All other input is ignored. To
demonstrate, type DC9G to the APPLE II
monitor.
Put Yourself in Control with the
-^^fi^PVETHROTTL E
Thaf s right! The APPl£.THROrTLf will turn
your game F>addJes into a speed controller.
By simpi/ pushing a button, you can stop
your computer for as long as you want.
Release the button, and your computer
enters a slow-motion mode with one
paddle CiDntrolling the speed. And if that
isn't enough, look at these additional
features:
• Plugs nto any slot
• Worta with machine language, Integer
BASIC, and Applesoft
• Normnl ■ slow - stop
• Use to UST, TRACE, RON, etc.
• NO SOFTWARE to load
• Unveil program secrets -^APPLETHROTTIE
And there's more! No more multiple LIST commands to view small program
sections. With the MVLETHROTTLE, you'll be able to list or trace long
programs while watching your program flow in slow-motion. So get in control
with the ^PPLETHROTTLE and order yours today!
$89.95
APPLETIME.a Real Time Clock
fortheA|3plelI. Rugs directly into any
slot and keeps time even when
computer is off. Features 12/24
Hour, BCD/ASai data fomiat, and
AC/Crystal time base selection.
Includes software examples for
machine language and BASIC pro-
grams. Completely assembled and
tested.
APT-1 Real Time Dock $79.95
PROTOBOARD.with over 1300
holes on 0.1 centers for designing
your own circuits.
APB-1 Piotob(3ard .... $17.95
VERBATIM 5 V<" DISKETTES
Soft-Sector Box of 10 . . . $34.50
(plastic file case included)
west side electronics
P.O. Box 636, Chatsworth, CA 9131 1
We pay ail shipping in Continenial USA
Others add W%. California residents add 6% tax
6502 Bibliography: Part XIV
William R. Dial
438 Roslyn Avenue
Akron, OH 44320
491. Rainbow 1, Number 4 (April, 1979)
Minch, David "Review. Electronic Index Card", pi.
This program by Bob Bishop emulates a card index file
but the reviewer doesn't thinly it offers substantial ad-
vantages.
Editor, "Pascal", p2.
The editor discusses the Pascal Language soon to be
available to Apple owners.
Simpson, Rick "Introduction to Assembly Language Pro-
gramming" pgs. 4-19.
A tutorial article on this important subject.
Watson, Allen "HI-RES Color" pg. 10.
The relationship between the color subcarrier frequen-
cy and the color dots; also why there are gaps in ver-
tical and near vertical vectors in colors other than
white.
Minch, David "Firmware Review — Programmer's Aid
ROM"pgs. 11-12.
The reviewer feels the ROM is a mixed blessing, of
limited utility. The Operating Manual is very good.
492. KB Microcomputing No 30 (June, 1979)
Lindsay, Len "PET Pouri" pgs. 6-12.
Discusses a way to protect software, evaluation of
cassette quality, new hardware and software,
periodicals with PET information, list protection, Trace
program, and disabling the STOP key.
Anon., "Ohio Scientific's Small System Journal"pg.8-11
Discussion of Microcomputer Information Manage-
ment systems.
Van Dyke, James A. "A Sneaky Interrupt for the 6502"
pg. 97.
A novel interrupt using the SO input pin.
493. Creative Computing 5 No 5 (May, 1979)
Kelley, Derek "Beyond the Text Editor"pgs. 32-33.
Program that searches for words, etc., on the Apple.
Hunter, Jim "Peripherals Unlimited Text Editor" p.46.
Upper and Lower case word processing with the Dan
Paymar lower case adapter for the Apple and this Text
Editor.
Yob, Gregory "Personal Electronic Transactions"
pgs. 122-127.
I/O on the PET, Notes on PET Graphics, including
higher resolution, a list of PET I/O lines.
494. Personal Computing 3 (June, 1979)
Zimmermann, Mark "Line Renumbering Renumbered"
pg-7.
Modifications to the earlier program published in
March, for the Apple.
Zimmermann, Mark " 'G' is for Graphics" pgs. 38-41.
An educational picture book for the kids on the PET.
495. Cider Press 2 (May, 1979)
Anon. "Apple Tape Beeps Translated" pg.3.
Why the beeps are on the leader and at the end of pro-
grams.
Anon. "May DOM" pg. 2.
The May Disk of the Month has a good mix of pro-
grams of different categories; games, utilities,
business, etc. Apple.
Hertzfeld, Andy "An Easy Way to Use Text Page 2"pg.3.
Add text to page two graphics using these instructions
on the Apple.
Aldrich, Ron "Split Catalog" pg.4.
Split your catalog print-out on the Apple Disk, printing
two titles across the page.
Kamins, Scot and Guarriques, Chris "Mini-Word Pro-
cessor" pg.4.
The Cider Squeezer was specifically designed to aid
Apple users to write short articles.
Draper, John T. "Textwriter's Creation ' pg.5.
Discussion of how a word processor evolved. Apple.
Espinosa, Chris and Wyman, Paul "CALLS, POKES and
PEEKS" pgs. 6-7.
A convenient listing of these important routines for the
Apple.
Silverman, Ken "Filling your Memory Cells" pg.7.
An updated listing of the various 16K dynamic RAMs
now available together with speed designations, etc.
Eleware of units of 300 NS or even slower speed.
Nareff, Max J. "Matrix Simulation with the Apple, Part
III" pgs. 8-9.
A.nother installment in this continuing series.
Sullivan, Charles Jr. "Meeting with Sargon" pg.9.
Chess 4 by the author and the wll known Sargo
it out on the chess board. Apple.
November, 1979
MICRO — The 6502 Journal
I fight
18:61
Anon. "Applibrary" pgs. 10-11.
The Apple Core Library now lists 274 progranns in 13
different categories, for the Apple II.
496. Call -Apple 2 No 4 (Apr./May, 1979)
Snnith, Ken and Scharen, Rosalie "Analysis of the Great
Hello Program", pgs. 4-7.
Analysis of the tricks in this interesting progrann.
Apple.
Golding, Val J. "Integral Data IP 225 Printer: A Review"
pgs. 8-11.
How to use this printer with the Apple. A Printer Driver
routine by Darrell and Ron Aldrich is given.
Aldrich, Ron "Ron's Page" pgs. 12-17.
Hl-Res Screen Dump Routine, Split Catalog Routine, etc.
Suitor, Richard F. "Apple Disk Operating System" pg.17
A discussion including some insights into the details of
the new Apple Disk DOS 3.2.
Winston, Alan B. "The Multilingual Apple" pgs 18-19.
Discussion of languages other than Basic for the Apple:
PILOT, FORTH, FCL65E, XPLO, Pascal.
Aldrich, Darrell "Monitor Calls, Cross References and
Memory Map" pgs 20-23.
Important calls and addresses based on the authors
research.
Aldrich, Darrell "The Apple Doctor" pgs 30-31.
How to save a shape table along with an Applesoft Pro-
gram.
Golding, Val J. "Routine to Center Titles" pg.31.
A simple integer Basic Utility.
497. MICRO No 12 (May, 1979)
Morganstein, David 'Real-Time Games on OSI" pgs 31-33
How real-time games can be written for Challenger
systems which use a serial terminal run from the ACIA.
498. Rainbow 1, Issue 5 (May, 1979)
Memory Enterprises "Color-Killer Module" pg.6.
An easy to install module to add the color-killer function to
early model Apple Ms.
Watson, Allen III "Another Review of the Programmer's
AID#1" pgs. 7-10.
A description of the features of this accessory ROM.
Anon. "An Interview with Phil Roybal of Apple Corp"
pgs 11-13.
Phil Roybal, marketing manager for Apple Corp., reveals
that coming soon is an "auto-start" monitor ROM that will
power up the Apple directly into Basic, or upon hitting
reset, also a stop list feature, easier cursor control, etc.
499. Calculator/Computers 3 (Jan./Feb., 1979)
Bobek, Frank "Vats Right" pgs 41-45.
A program to aid physics students studying velocity and
acceleration phenomena. For the PET.
500. CalcuiatoryComputers 2 (Nov.yDec., 1979)
Oglesby, Mac "Sinners" pgs 36-38.
Three of Satan's Fiends fight against a group of sinners.
For the PET.
501. Dr. Oobb's Journal 4, Issue 6 (June/July, 1979)
Colburn, Don "EXOS-A Software Development Tool Kit
for the 6500 Microprocessor Family" pgs. 29-31.
A tool to efficiently and effectively both generate and
modify 6500 assembly language programs.
Monsour, Fred J. "Kim Renumber" pg. 47.
A program to renumber KIM-1 Microsoft Basic listings.
502. Stems From Apple 2, Issue 5 (May, 1979)
Armstrong, Kevin "Numeric Sort Routine" pg.2.
A sort program written in Applesoft II.
Reed, Ron "Paddle Speed Control" pg.3.
Control a slow list or program execution with the Apple
paddles.
Hoggatt, Ken 'Ken's Korner" pgs 4-5.
A series of tutorials for the Apple user including the use of
GET A or GET $A, the use of the mini-assembler, Yes and
No statements, etc.
503. Recreational Computing 7, Issue 39 (May/June, 1979)
Feniger, Bob "A Different Way to Float" pg. 6.
A different version of an earlier program for the PET.
Carpenter, Chuck "PILOT for the Apple
MICF10-PIL0T Interpreter" pgs 28-31.
An interpreter in Applesoft.
An Extended
Saal, Harry "SPOT" pgs. 52-55.
Notes for PET users include information on new models of
the PET, a review of Cursor cassette magazine, new books
on the PET, and a graphics program listing called
CASCADES.
504. Creative Computing 5, No 6 (June, 1979)
Badgett, J. Tom "Strings and Things: Basic String Man-
ipulations" pgs. 86-90.
Tutorial on String variables, etc.
North, Steve "ALF/Apple Music Synthesizer" pgs 102-103
Review of the new Accessory for the Apple which makes
possible high-quality computer music.
Soft-One "Apple Graphics Programs" pg. 143.
High Resolution Graphics Utility Set, including character
set, lower case, shape vector table assembler, etc.
505. MICRO No 13 (June, 1979)
Putney, Charles B."Harmonic Analysis for the
Apple" pgs 5-8.
A program in Applesoft Floating Point BASIC lets the Ap-
ple do Fourier Analysis calculations.
Pytlik, William F. "Case of the Missing Tape Counter"
pg.11.
How to locate your files on the PET Cassette.
Taylor, William L. "The Basic Morse Keyboard" pgs 13-
15.
A Ham program implemented on an OSI system to make an
ASCII keyboard act as a "Morse Keyboard."
Rinard, Phillip M. 'A SYM-phony in Stereo " pgs 17-19
This music program uses the 6532 and the 6522's of the
SYM to generate stereo music.
Foote, Gary A. 'Sorting with the APPLE II- Part l"pgs.
21-26.
The first installment presents some background
material and compares three sorting techniques and
gives a program for the SHELL-METZNER sort.
Cass, James L. 'Streamlining the C2-4P" pg.28
Three modifications for the OSI C2-4P to raise its
speed, increase cassette through put and add reverse
video to the display.
18:62
MICRO — Tlie 6502 Journal
November, 1979
fSLl THIS PfBEHfS fin
1C Eitar [Jala in iEm [^bjIgu]
an [Tlail f Em
SEfnpEiar BatalEg I
SB Ell ■
lUail [lEnaf
Fofiow this simple program and you will receive
The Personal Computer Catalog. The one refer-
ence book to fine quality personal computers,
software, supplies and accessories.
This valuable catalog is FREE so mail your order
today.
Address.
City
Do you own a computer?.
.What type?
Do you use your computer for:
Personal? Education?
Business?.
-Other?
Mail this form to:
CDddonEkxtroniQ
SERVING THE PERSCDNAL
Or phone: (612) 884-1475
COMPUTER INDUSTRY "
Weldon Electronics
4150 Hiilcrest Road
Wayzata, MN 55391
AIM 65
AIM 65 is fully assembled, tested and warranted. With the
addition of a low cost, readily available power supply, it's
ready to start working for you.
AIM 65 features on-board thermal printer and
alphanumeric display, and a terminal-style keyboard. It
has an addressing capability up to 65K bytes, and comes
with a user-dedicated 1K or 4K RAM. Two installed 4K
ROMS hold a powerful Advanced Interface Monitor
program, and three spare sockets are included to expand
on-board ROM or PROM up to 20K bytes.
An Application Connector provides for attaching a TTY
and one or two audio cassette recorders, and gives exter-
nal access to the user-dedicated general purpose I/O lines.
Also included as standard are a comprehensive AIM 65
User's Manual, a handy pocket reference card, an R6500
Hardware Manual, an R6500 Programming Manual and an
AIM 65 schematic.
AIM 65 is packaged on two compact modules. The
circuit module is 12 inches wide and 10 inches long, the
keyboard module is 12 inches wide and 4 inches long.
They are connected by a detachable cable.
THERMAL PRINTER
Most desired feature on low-cost microcomputer systems . . .
• Wide 20-column printout
• Versatile 5x7 dot matrix format
• Complete 64-character ASCII alphanumeric format
• Fast 120 lines per minute
• Quite thermal operation
• Proven reliability
FULL-SIZE ALPHANUMERIC KEYBOARD
Provides compatibility with system terminals . . .
• Standard 54 key, terminal-style layout
• 26 alphabetic characters
• 10 numeric characters
• 22 special characters
• 9 control functions
• 3 user-defined functions
TRUE ALPHANUMERIC DISPLAY
Provides legible and lengthy display . . .
• 20 characters wide
• 16-segment characters
• High contrast monolithic characters
• Complete 64-character ASCII alphanumeric format
BY ROCKWELL INTERNATIONAL
PROVEN R6500 MICROCOMPUTER SYSTEM DEVICES
Reliable, high performance NMOS technology . . .
• R6502 Central Processing Unit (CPU), operating at 1
MHz. Has 65K address capability, 13 addressing modes
and true index capability. Simple but powerful 56
instructions.
• Read/Write Memory, using R2114 Static RAM devices.
Available in IK byte and 4K byte versions.
• 8K Monitor Program Memory, using R2332 Static ROM
devices. Has sockets to accept additional 2332 ROM or
2532 PROM devices, to expand on-board Program
memory jp to 20K bytes.
• R6532 RAM-Input/Output-Timer (RIOT) combination
device. Multipurpose circuit for AIM 65 Monitor functions.
• Two R6522 Versatile Interface Adapter (VIA) devices,
which support AIM 65 and user functions. Each VIA has
two parallel and one serial 8-bit, bidirectional I/O ports,
two 2-bit peripheral handshake control lines and two
fully-programmable 16-bit interval timer/event counters.
BUILT-IN EXPANSION CAPABILITY
• 44-Pin Application Connector tor peripheral add-ons
• 44-Pin Expansion Connector has full system bus
• Both connectors are KIM-1 compatible
TTY AND AUDIO CASSETTE INTERFACES
Standard interface to low-cost peripherals . . .
• 20 ma. current loop TTY interface
• Interface for two audio cassette recorders
• Two audio cassette formats: ASCII KIM-1 compatible
and binary, blocked file assembler compatible
ROM RESIDENT ADVANCED INTERACTIVE MONITOR
Advanced features found only on larger systems . . .
• Monitor-generated prompts
• Single keystroke commands
• Address independent data entry
• Debug aids
• Error messages
• Option and user interface linkage
ADVANCED INTERACTIVE MONITOR COMMANDS
• Major Function Entry
• Instruction Entry and Disassembly
• Display/Alter Registers and Memory
• Manipulate Breakpoints
• Control Instruction/Trace
• Control Peripheral Devices
• Call User-Defined Functions
• Comprehensive Text Editor
LOW COST PLUG-IN ROM OPTIONS
• 4K Assembler— symbolic, two-pass $79.00
• 8K BASIC Interpreter $99.00
POWER SUPPLY SPECIFICATIONS
• -1-5 VDC ± 5% regulated @ 2.0 amps (max)
• -1-24 VDC ±15% unregulated @ 2.5 amps (peak)
0.5 amps average
PRICE: $369.00 (ikram)
Plus $4.00 UPS (shipped in U.S. must give street address),
$10 parcel post to APO's, FPO's, Alaska, Hawaii, Canada,
$25 air mail to all other countries
We manufacture a complete line of high quality expansion
boards. Use reader service card to be added to our mailing
list, or U.S. residents send $1.00 (International send $3.00
U.S.) for airmail delivery of our complete catalog.
ENTERPRISES
INCORPORATED
2967 W. Fairmount Avenue
Phoenix AZ 85017
(602)265-7564
^
^gp
* ^ NOWPRiSiNTINa.. ^~^^
Soft^vare for Apple II
for your Entertainment ' Business ' Education
Star Attraitlons:
FILEMASTER 2 proqram%: FORMAT & RETRIEVAL comprise
a powerful data file manager. Great for everything from phone lists
to legal abstracts. Needs 32K. Design your own data structure. Up
to 500 characters per record. Up to 15 searchable fields in any com-
bination. On Disk $34.95
SPACE Multi-faceted simulation of life in interstellar society. You
and opponents must make life & death decisions. Keeps track of
your progress from one game to next. Needs 48K and Applesoft
ROM. Disk $29.95
Pot O'Gold I or our All New Pot 0' Gold II A collection of 49 pro-
grams for 16K Apple. Everything from Logic to action games. Only
a buck a game. Specify I or II. Price each: Tape $49 .... Disk $54
ADVENTURE Fight off pirates and vicious dwarfs. 700 travel op-
tions, 140 locations, 64 objects. Needs ROM & 48K. Disk. . $29.95
16K CASSETTE INVENTORY Use item number, description,
stock amount, reorder amount, restock date, cost & sell price. Holds
up to 140 items. Tape $35
32K DISK INVENTORY: Use stock numbers description, vendor,
record of purchase and sales date, amount on hand, cost & sell price,
total value. Holds up to 300 items. Disk $40
With Parts Explosion: Disk $50
32K DATA BASE Cross file for phone lists, bibliographies, recipes.
Run up to 9 lines of 40 columns each. Search by item anywhere.
Disk $20
24K HI-RES LIFE SIMULATION Conway's equations on 296x180
screen. A mathematical simulation to demo population growth with
birth, death and survival as factors. Tape $10
16K CIRCUIT LOGIC DEVELOPMENT AID Evaluate circuits of
up to 255 gates, including AND, OR, NOR, IMAIMD, XOR, XNOR
and INVERTER. Tape $10
1BK MORSE CODE TRAINER Learn Morse Code, and transmit or
receive over radio. Tape $10
16K DEVIL'S DUNGEON: Adventure through dark passages where
monsters, demons, poisonous gas, dropoffs threaten ... all to disco-
ver fantastic treasures. Comes with instruction book. Tape . . . $10
16K PACIFICA: Discover the floating island and rescue the beauti-
ful princess. To win you must recover the enchanted crown, but you
face the threat of magic spells and demons. Tape $9.95
Don't see what you've been looking for, here?
Then write for our FREE SOFTWARE CATALOG.
We're saving one just for you I
To order software, add $2 shipping. To transfer tape ver-
sions to disk add $5. California residents add 6% sales tax.
Sorry, we can not ship to P. 0. Boxes. VISA/MASTERCHARGE
Welcomed!
RAINBOW'S CASINO 9 gambling games: Roulette, Blackjack,
Craps, Horserace, and a few originals that Vegas hasn't heard about.
Needs 16K. Tape $29.95
16K SPACE WAR: You in your space capsule battle against the
computer's saucer ... in hi-res graphics. Tape $12
16K MEMORY VERIFY Diagnostic routine to check range of mem-
ory. Indicates faulty addresses, data in memory cell, and faulty data.
Tape $5
16K APPLEODION Music synthesis composes original Irish jigs.
Enter your own music and save on tape or disk. Includes 3 Bach
fugues. Tape $10
16IK APPLEViSION Demo for Hi-Res graphics and music.
Tape $10
32IK COMPU-READ 5 programs to teach you speed reading, in
stages. Includes synonym and antonym identification. You control
your rate of speed, or keep up with the computer's pace.
Disk $24.95
48K PERCEPTION I, II, III random shapes and sizes must be
matched. In 111, you control format and display time and get
weighted scores. Needs ROM. Each Disk $24.95
32K STORY TELLER Use your bizarre imagination and input key
words for fantastic and funny tales. Never the same story twice.
Tape $12.95
32K WAR/RESCUE Engage in 10 battles with your infantry against .
the Apple robots. Calculate Apple's strategy and win more battles
than the computer. Tape $12.95
24K POLAR PLOT Plot polar equations in Hi-Res Graphics.
Tape $10
32K SHAPE SCALER Utility to generate and animate Hi-Res
graphic shapes. Simple routine provided to inspect position of
shapes, and specify precise X/Y coordinates and scale. Needs ROM.
Disk $13.95
32K ZINTAR/PROPHET Great party game. Under control of the
mighty Zintar's edict you take a very special trip to the world of
Krintar. Heightened visual graphics. Needs ROM. Disk .... $16.95
APPLE MONITOR PEELED Everything you wanted to know about
the Apple Monitor but couldn't figure out. User-written manual in
pkiin English clears your confusion. Only $9.95
Garden Plaza Shopping Center, Dept. 1 1 A
9719 Reseda Blvd., Northridge, Ca 91324
Telephone: (213) 349-5560
APPLE II® JOYSTICK & EXPANDA-PORT
EVERY APPLE II OWNER SHOULD HAVE ONE!
The PROGRAIVIIVIA JOYSTICK is an input peripheral that
attaches to the APPLE II Computer's game I/O Port, The
JOYSTICK is a must for the serious game player, and it
offersa degreeof linearity not currently available with other
joysticks. The ease of manueverability and the availability
of the "functional" switches make the PROGRAMMA
JOYSTICK a much needed enhancement to any APPLE II
Computer System owner. The PROGRAMMA JOYSTICK
comes completely assembled and tested, including a User's
Guide.
JOYSTICK
$49.95
EXPANDA-PORT $49.95
PROGRAMMA
IIMTERNATIOraAL, INC.
3400 Wilshire Blvd.
Los Angeles, CA 90010 (213) 384-0579
The PROGRAMMA EXPANDA-PORT is a multi-port ex-
pander for the game I/O port of any APPLE II Computer
System. In addition to allowing expansion for up to six
devices, the EXPANDA-PORT contains a built-in speaker
that replaces the function of the Apple ll's speaker. The
switcheson the EXPANDA-PORT allow for the selection of
the specific device desired and for the switching of that de-
vice. No unplugging of any device connected to the
EXPANDA-PORT is required. The PROGRAMMA EX-
PANDA PORT comes completely assembled and tested, in-
cluding a User's guide.
The PROGRAMMA JOYSTICK and EXPANDA-PORTare
available on a limited basis through your local computer
dealer. Apple II is a registered trademark of Apple Com-
puters, Inc.
D
Ca^
? ?
n Jet
in 3 T
384-1116 • 384-1117